faraday/test/adapters/rack_test.rb
Leon Miller-Out a38ba7a13b Adds reason phrase support (#547)
* Adds a `#reason_phrase` method to the Response class
Implements the reason phrase for the Net::Http adapter ONLY

* Reason phrase support for the Excon adapter

This assumes that the reason phrase is also implemented into the
Excon project

* Implement reason phrase for patron, httpclient, em_http, em_synchrony adapters.

* Don't test for reason phrase with Rack adapter, which doesn't make it available.

* Don't test for reason phrase support in Typhoeus adapter.

* Make reason_phrase nil in adapters that don't support it (instead of "")
2016-08-24 17:43:19 +01:00

39 lines
1.0 KiB
Ruby

require File.expand_path("../integration", __FILE__)
require File.expand_path('../../live_server', __FILE__)
module Adapters
class RackTest < Faraday::TestCase
def adapter() :rack end
def adapter_options
[Faraday::LiveServer]
end
# no Integration.apply because this doesn't require a server as a separate process
include Integration::Common
include Integration::NonParallel
# Rack::MockResponse doesn't provide any way to access the reason phrase,
# so override the shared test from Common.
def test_GET_reason_phrase
response = get('echo')
assert_nil response.reason_phrase
end
# not using shared test because error is swallowed by Sinatra
def test_timeout
conn = create_connection(:request => {:timeout => 1, :open_timeout => 1})
begin
conn.get '/slow'
rescue Faraday::Error::ClientError
end
end
# test not applicable
undef test_connection_error
undef test_proxy
undef test_proxy_auth_fail
end
end