spec/client_spec.rb in tokyo_api-1.4.1 vs spec/client_spec.rb in tokyo_api-1.5.0
- old
+ new
@@ -1,16 +1,26 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe TokyoApi::Client do
-
- describe "instantiated" do
+ describe 'initialisation' do
subject { described_class.new(options) }
- context 'process_basic_auth' do
- let(:options) { { :basic_auth => 'login:password' } }
- let(:config) { subject.connection.configuration }
- specify { expect(config.username).to eq 'login' }
- specify { expect(config.password).to eq 'password' }
+ context 'with a basic_auth string parameter' do
+ let(:options) { {basic_auth: 'login:password'} }
+
+ it 'should set username/password on the configuration' do
+ config = subject.connection.configuration
+ expect(config.username).to eq 'login'
+ expect(config.password).to eq 'password'
+ end
end
+ context 'with a timeout' do
+ let(:options) { {timeout: 5} }
+
+ it 'should set the timeout on the faraday options' do
+ config = subject.connection.configuration
+ expect(config.faraday_options[:request][:timeout]).to eq 5
+ end
+ end
end
-end
\ No newline at end of file
+end