forked from loafle/openapi-generator-original
Add "servers" support to Ruby API client (#1280)
* update ruby samples with OAS3 spec * add server support to ruby api client * minor format change * minor format fix, skip form models * better exception and add test for invaid value * remove exception test code
This commit is contained in:
@@ -22,4 +22,34 @@ describe Petstore::Configuration do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'server settings' do
|
||||
it 'should return an array of server settings' do
|
||||
expect(config.auth_settings).not_to be_empty
|
||||
end
|
||||
|
||||
it 'should get the first url' do
|
||||
url = config.server_url(0, server: "dev-petstore", port: "8080")
|
||||
expect(url).to eq("http://dev-petstore.swagger.io:8080/v2")
|
||||
end
|
||||
|
||||
it 'should get the first url with default values' do
|
||||
url = config.server_url(0)
|
||||
expect(url).to eq("http://petstore.swagger.io:80/v2")
|
||||
end
|
||||
|
||||
it 'should get the second url with default values' do
|
||||
url = config.server_url(1)
|
||||
expect(url).to eq("https://api.gigantic-server.com:8080/v2")
|
||||
end
|
||||
|
||||
it 'should get the second url' do
|
||||
url = config.server_url(1, version: "v1")
|
||||
expect(url).to eq("https://api.gigantic-server.com:8080/v1")
|
||||
end
|
||||
|
||||
it 'should raise error due to invalid enum value' do
|
||||
expect{config.server_url(1, version: "v6")}.to raise_error(ArgumentError)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user