work around the fact that timeout is different on my Mac than on Travis

This commit is contained in:
Mislav Marohnić 2012-04-15 16:37:14 +02:00
parent 2d290f63da
commit ec6ef38713

View File

@ -17,8 +17,16 @@ module Adapters
# not using shared test because error is swallowed by Sinatra
def test_timeout
conn = create_connection(:request => {:timeout => 1, :open_timeout => 1})
err = assert_raise(Faraday::Error::ClientError) { conn.get '/slow' }
assert_include err.response[:body], 'execution expired'
err = assert_raise { conn.get '/slow' }
case err
when Faraday::Error::ClientError
# happens on Mac OS
assert_include err.response[:body], 'execution expired'
else
# happens on Travis
assert_instance_of Timeout::Error, err
end
end
end