Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update_attributes on connect outgoing caller id

  • Loading branch information...
commit c0ac0fc7c2dcd2fa9d4ee956fb4b24c14cfdb3ab 1 parent b05032a
@stevegraham authored
Showing with 21 additions and 0 deletions.
  1. +21 −0 spec/outgoing_caller_id_spec.rb
View
21 spec/outgoing_caller_id_spec.rb
@@ -284,6 +284,27 @@ def stub_api_call(response_file, account_sid=nil)
describe '#update_attributes' do
let(:caller_id) { Twilio::OutgoingCallerId.create params }
+
+ context 'using a twilio connect subaccount' do
+ it 'uses the account sid for basic auth' do
+ stub_request(:post, resource_uri('AC0000000000000000000000000000', true) + '.json' ).
+ with(:body => post_body).
+ to_return :body => canned_response('connect_caller_id'), :status => 200
+ caller_id = Twilio::OutgoingCallerId.create params.merge :account_sid => 'AC0000000000000000000000000000', :connect => true
+
+ stub_request(:post, resource_uri('AC0000000000000000000000000000', true) + '/' + caller_id.sid + '.json' ).
+ with(:body => 'FriendlyName=foo').
+ to_return :body => canned_response('connect_caller_id'), :status => 200
+
+ caller_id.update_attributes :friendly_name => 'foo'
+
+ a_request(:post, resource_uri('AC0000000000000000000000000000', true) + '/' + caller_id.sid + '.json' ).
+ with(:body => 'FriendlyName=foo').
+ should have_been_made
+
+ end
+ end
+
before do
stub_request(:post, resource_uri + '.json').with(:body => post_body).
to_return :body => canned_response('caller_id')
Please sign in to comment.
Something went wrong with that request. Please try again.