openapi-generator/samples/client/petstore/ruby/spec/configuration_spec.rb
xhh e9ef143d8f Ruby client: allow setting Configuration in ApiClient
Removed the singleton design from the Configuration class.
Added a `config` field to ApiClient to hold the settings the ApiClient
uses.
2015-12-10 15:25:07 +08:00

26 lines
596 B
Ruby

require 'spec_helper'
describe Petstore::Configuration do
let(:config) { Petstore::Configuration.default }
before(:each) do
Petstore.configure do |c|
c.host = 'petstore.swagger.io'
c.base_path = 'v2'
end
end
describe '#base_url' do
it 'should have the default value' do
config.base_url.should == 'http://petstore.swagger.io/v2'
end
it 'should remove trailing slashes' do
[nil, '', '/', '//'].each do |base_path|
config.base_path = base_path
config.base_url.should == 'http://petstore.swagger.io'
end
end
end
end