Skip to content
This repository has been archived by the owner on Jul 23, 2023. It is now read-only.

Commit

Permalink
update_attributes on connect outgoing caller id
Browse files Browse the repository at this point in the history
  • Loading branch information
stevegraham committed Nov 9, 2011
1 parent b05032a commit c0ac0fc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec/outgoing_caller_id_spec.rb
Expand Up @@ -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')
Expand Down

0 comments on commit c0ac0fc

Please sign in to comment.