spec/api-client/configuration_spec.rb in api-client-3.0.0 vs spec/api-client/configuration_spec.rb in api-client-3.1.0

- old
+ new

@@ -60,34 +60,36 @@ end describe '#header' do context 'when not configured' do it 'should return a hash with configs for content_type only' do - ApiClient.config.header.should == { 'Content-Type' => 'application/json' } + ApiClient.config.header.should == { 'Content-Type' => 'application/json', 'Accept' => 'application/json' } end end context 'when configured' do before :each do - ApiClient.config.instance_variable_set('@header', { 'key' => 'value' }) + ApiClient.configure do |config| + config.header = { 'key' => 'value' } + end end - it 'should return a hash with the configured header' do - ApiClient.config.header.should == { 'key' => 'value' } + it 'should return the configs merged' do + ApiClient.config.header.should == { 'Content-Type' => 'application/json', 'Accept' => 'application/json', 'key' => 'value' } end end end describe '#header=' do before :each do ApiClient.configure do |config| - config.header = { 'Content-Type' => 'application/xml' } + config.header = { 'Content-Type' => 'application/xml', 'Accept' => 'application/xml' } end end it 'should merge content_type json with the given hash' do - ApiClient.config.header.should == { 'Content-Type' => 'application/xml' } + ApiClient.config.header.should == { 'Content-Type' => 'application/xml', 'Accept' => 'application/xml' } end end describe '#basic_auth=' do before :each do @@ -102,9 +104,10 @@ end end it 'should merge basic_auth in header params' do ApiClient.config.header.should == { 'Content-Type' => 'application/xml', + 'Accept' => 'application/xml', 'Authorization' => 'Basic dXNlcjpwYXNz' } end end end \ No newline at end of file