spec/acceptance/rest/base_spec.rb in ably-1.1.4 vs spec/acceptance/rest/base_spec.rb in ably-1.1.5
- old
+ new
@@ -85,22 +85,26 @@
describe 'server error with JSON error response body', :webmock do
let(:error_response) { '{ "error": { "statusCode": 500, "code": 50000, "message": "Internal error" } }' }
before do
- stub_request(:get, "#{client.endpoint}/time").
- to_return(:status => 500, :body => error_response, :headers => { 'Content-Type' => 'application/json' })
+ (client.fallback_hosts.map { |host| "https://#{host}" } + [client.endpoint]).each do |host|
+ stub_request(:get, "#{host}/time")
+ .to_return(:status => 500, :body => error_response, :headers => { 'Content-Type' => 'application/json' })
+ end
end
it 'should raise a ServerError exception' do
expect { client.time }.to raise_error(Ably::Exceptions::ServerError, /Internal error/)
end
end
describe '500 server error without a valid JSON response body', :webmock do
before do
- stub_request(:get, "#{client.endpoint}/time").
- to_return(:status => 500, :headers => { 'Content-Type' => 'application/json' })
+ (client.fallback_hosts.map { |host| "https://#{host}" } + [client.endpoint]).each do |host|
+ stub_request(:get, "#{host}/time").
+ to_return(:status => 500, :headers => { 'Content-Type' => 'application/json' })
+ end
end
it 'should raise a ServerError exception' do
expect { client.time }.to raise_error(Ably::Exceptions::ServerError, /Unknown/)
end