spec/rest/client_spec.rb in twilio-ruby-5.26.0 vs spec/rest/client_spec.rb in twilio-ruby-5.27.0
- old
+ new
@@ -47,9 +47,31 @@
expect { Twilio::REST::TrunkingClient.new }.to raise_error(Twilio::REST::ObsoleteError)
end
end
describe Twilio::REST::Client do
+ before do
+ Twilio.configure do |config|
+ config.account_sid = 'someSid'
+ config.auth_token = 'someToken'
+ config.http_client = 'someClient'
+ end
+ end
+
+ it 'uses the global configuration by default' do
+ @client = Twilio::REST::Client.new
+ expect(@client.account_sid).to eq('someSid')
+ expect(@client.auth_token).to eq('someToken')
+ expect(@client.http_client).to eq('someClient')
+ end
+
+ it 'uses the arguments over global configuration' do
+ @client = Twilio::REST::Client.new('myUser', 'myPassword', nil, nil, 'myClient')
+ expect(@client.account_sid).to eq('myUser')
+ expect(@client.auth_token).to eq('myPassword')
+ expect(@client.http_client).to eq('myClient')
+ end
+
it 'successfully validates the working SSL certificate' do
@holodeck.mock Twilio::Response.new(200, '')
expect { @client.validate_ssl_certificate }.not_to raise_error
end