spec/rest/client_spec.rb in twilio-ruby-3.12.3 vs spec/rest/client_spec.rb in twilio-ruby-3.13.0
- old
+ new
@@ -59,18 +59,18 @@
expect { Twilio::REST::Client.new 'someSid' }.to raise_error(ArgumentError)
end
end
it 'should not raise an error if the response body is empty' do
- FakeWeb.register_uri(:any, %r/api\.twilio\.com/, :body => '')
+ FakeWeb.register_uri(:any, %r/api\.twilio\.com/, body: '')
twilio = Twilio::REST::Client.new('someSid', 'someToken')
Twilio::REST::IncomingPhoneNumber.new('/phone_number', twilio).delete
end
it 'should not raise an error if the response body is nil' do
- response = double(:response, :body => nil)
- connection = double(:connection, :request => response)
+ response = double(:response, body: nil)
+ connection = double(:connection, request: response)
twilio = Twilio::REST::Client.new('someSid', 'someToken')
twilio.instance_variable_set(:@connection, connection)
Twilio::REST::IncomingPhoneNumber.new('/phone_number', twilio).delete
end
@@ -87,46 +87,65 @@
expect(connection.port).to eq(443)
expect(connection.use_ssl?).to eq(true)
end
it 'should set up the requested ssl verification ca_file if provided' do
- twilio = Twilio::REST::Client.new('someSid', 'someToken', :ssl_ca_file => '/path/to/ca/file')
+ twilio = Twilio::REST::Client.new(
+ 'someSid', 'someToken', ssl_ca_file: '/path/to/ca/file'
+ )
connection = twilio.instance_variable_get('@connection')
expect(connection.ca_file).to eq('/path/to/ca/file')
end
- it 'should set up the proper http ssl connection when a different domain is given' do
- twilio = Twilio::REST::Client.new('someSid', 'someToken', :host => 'api.faketwilio.com')
+ it 'should set up the proper http ssl connection when a different ' \
+ 'domain is given' do
+ twilio = Twilio::REST::Client.new(
+ 'someSid', 'someToken', host: 'api.faketwilio.com'
+ )
connection = twilio.instance_variable_get('@connection')
expect(connection.address).to eq('api.faketwilio.com')
expect(connection.port).to eq(443)
expect(connection.use_ssl?).to eq(true)
end
- it 'should adjust the open and read timeouts on the underlying Net::HTTP object when asked' do
+ it 'should adjust the open and read timeouts on the underlying Net::HTTP ' \
+ 'object when asked' do
timeout = rand(30)
- twilio = Twilio::REST::Client.new('someSid', 'someToken', :timeout => timeout)
+ twilio = Twilio::REST::Client.new('someSid', 'someToken', timeout: timeout)
connection = twilio.instance_variable_get('@connection')
expect(connection.port).to eq(443)
expect(connection.use_ssl?).to eq(true)
expect(connection.open_timeout).to eq(timeout)
expect(connection.read_timeout).to eq(timeout)
end
- it 'should set up the proper http ssl connection when a proxy_host is given' do
- twilio = Twilio::REST::Client.new('someSid', 'someToken', :host => 'api.faketwilio.com', :proxy_addr => 'localhost')
+ it 'should set up the proper http ssl connection when a proxy_host is ' \
+ 'given' do
+ twilio = Twilio::REST::Client.new(
+ 'someSid',
+ 'someToken',
+ host: 'api.faketwilio.com',
+ proxy_addr: 'localhost'
+ )
connection = twilio.instance_variable_get('@connection')
expect(connection.proxy?).to eq(true)
expect(connection.proxy_address).to eq('localhost')
expect(connection.proxy_port).to eq(80)
expect(connection.address).to eq('api.faketwilio.com')
expect(connection.port).to eq(443)
expect(connection.use_ssl?).to eq(true)
end
- it 'should set up the proper http ssl connection when a proxy_host and proxy_port are given' do
- twilio = Twilio::REST::Client.new('someSid', 'someToken', :host => 'api.faketwilio.com', :proxy_addr => 'localhost', :proxy_port => 13128)
+ it 'should set up the proper http ssl connection when a proxy_host and ' \
+ 'proxy_port are given' do
+ twilio = Twilio::REST::Client.new(
+ 'someSid',
+ 'someToken',
+ host: 'api.faketwilio.com',
+ proxy_addr: 'localhost',
+ proxy_port: 13128
+ )
connection = twilio.instance_variable_get('@connection')
expect(connection.proxy?).to eq(true)
expect(connection.proxy_address).to eq('localhost')
expect(connection.proxy_port).to eq(13128)
expect(connection.address).to eq('api.faketwilio.com')
@@ -135,16 +154,20 @@
end
it 'should set up an accounts resources object' do
twilio = Twilio::REST::Client.new('someSid', 'someToken')
expect(twilio).to respond_to(:accounts)
- expect(twilio.accounts.instance_variable_get('@path')).to eq('/2010-04-01/Accounts')
+ expect(twilio.accounts.instance_variable_get('@path')).to eq(
+ '/2010-04-01/Accounts'
+ )
end
it 'should set up an account object with the given sid' do
twilio = Twilio::REST::Client.new('someSid', 'someToken')
expect(twilio).to respond_to(:account)
- expect(twilio.account.instance_variable_get('@path')).to eq('/2010-04-01/Accounts/someSid')
+ expect(twilio.account.instance_variable_get('@path')).to eq(
+ '/2010-04-01/Accounts/someSid'
+ )
end
[
:sandbox, :available_phone_numbers, :incoming_phone_numbers,
:calls, :outgoing_caller_ids, :conferences, :sms, :recordings,