spec/api-client/configuration_spec.rb in api-client-2.3.0 vs spec/api-client/configuration_spec.rb in api-client-2.4.0
- old
+ new
@@ -1,18 +1,18 @@
require 'spec_helper'
describe ApiClient::Configuration do
describe '#path' do
- context 'when not configured' do
+ context 'when badly configured' do
before :each do
ApiClient.configure do |config|
config.path = ''
end
end
it 'should raise an error' do
- lambda { ApiClient.config.path }.should raise_error(ApiClient::Exceptions::NotConfigured)
+ expect { ApiClient.config.path }.to raise_error(ApiClient::Exceptions::BadlyConfigured)
end
end
context 'when properly configured' do
before :each do
@@ -32,21 +32,31 @@
before :each do
ApiClient.config.path = 'http://api.example.com'
end
it "should set it with a '/'" do
- ApiClient.config.path.should == 'http://api.example.com/'
+ ApiClient.config.path.should == { :default => 'http://api.example.com/' }
end
end
context "with a string with '/'" do
before :each do
ApiClient.config.path = 'http://api.example.com/'
end
it "should set it as passed" do
- ApiClient.config.path.should == 'http://api.example.com/'
+ ApiClient.config.path.should == { :default => 'http://api.example.com/' }
end
+ end
+ end
+
+ describe '#paths=' do
+ before :each do
+ ApiClient.config.paths = { :auth => 'http://auth.example.com', :default => 'http://panel.example.com' }
+ end
+
+ it 'should set several paths in a hash' do
+ ApiClient.config.path.should == { :auth => 'http://auth.example.com/', :default => 'http://panel.example.com/' }
end
end
describe '#header' do
context 'when not configured' do
\ No newline at end of file