Skip to content

Commit 19ef793

Browse files
committed
fix: Regional API domain processing
1 parent ceb2582 commit 19ef793

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

spec/rest/client_spec.rb

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,30 @@
4242
end
4343

4444
it 'uses the region edge mapping' do
45-
@client = Twilio::REST::Client.new
45+
@client = Twilio::REST::Client.new('myUser', 'myPassword', 'someSid', 'ie1', 'myClient', 'myLogger')
4646
expect(@client.account_sid).to eq('someSid')
47-
expect(@client.auth_token).to eq('someToken')
48-
expect(@client.http_client).to eq('someClient')
47+
expect(@client.auth_token).to eq('myPassword')
4948
expect(@client.region).to eq('ie1')
5049
expect(@client.edge).to eq('dublin')
51-
expect(@client.logger).to eq('someLogger')
50+
expect(@client.logger).to eq('myLogger')
51+
end
52+
53+
it 'catches warning when setting edge' do
54+
original_stderr = $stderr
55+
$stderr = StringIO.new
56+
begin
57+
@client = Twilio::REST::Client.new
58+
# Simulate a condition that would trigger a warning when setting edge
59+
allow(@client).to receive(:edge=).and_wrap_original do |m, *args|
60+
warn 'Edge is deprecated'
61+
m.call(*args)
62+
end
63+
@client.edge = 'deprecatedEdge'
64+
warnings = $stderr.string
65+
expect(warnings).to include('Edge is deprecated')
66+
ensure
67+
$stderr = original_stderr
68+
end
5269
end
5370

5471
class MyVersion < Twilio::REST::Version

0 commit comments

Comments
 (0)