mirror of
https://github.com/lostisland/faraday.git
synced 2025-10-08 00:03:41 -04:00
fix live tests
This commit is contained in:
parent
cc64429c76
commit
bc2cd52f70
@ -42,7 +42,8 @@ module Faraday
|
|||||||
end
|
end
|
||||||
|
|
||||||
def all_loaded_constants
|
def all_loaded_constants
|
||||||
constants.map { |c| const_get(c) }.select { |a| a.loaded? }
|
constants.map { |c| const_get(c) }.
|
||||||
|
select { |a| a.respond_to?(:loaded?) && a.loaded? }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ module Faraday
|
|||||||
def call(env)
|
def call(env)
|
||||||
super
|
super
|
||||||
full_path = full_path_for(env[:url].path, env[:url].query, env[:url].fragment)
|
full_path = full_path_for(env[:url].path, env[:url].query, env[:url].fragment)
|
||||||
body = env[:body].respond_to?(:read) ? env[:body]
|
|
||||||
@session.__send__(env[:method], full_path, env[:body], env[:request_headers])
|
@session.__send__(env[:method], full_path, env[:body], env[:request_headers])
|
||||||
resp = @session.response
|
resp = @session.response
|
||||||
env.update \
|
env.update \
|
||||||
|
@ -3,7 +3,10 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'helper'))
|
|||||||
if Faraday::TestCase::LIVE_SERVER
|
if Faraday::TestCase::LIVE_SERVER
|
||||||
module Adapters
|
module Adapters
|
||||||
class LiveTest < Faraday::TestCase
|
class LiveTest < Faraday::TestCase
|
||||||
(Faraday::Adapter.all_loaded_constants + [:default]).each do |adapter|
|
loaded_adapters = Faraday::Adapter.all_loaded_constants
|
||||||
|
loaded_adapters -= [Faraday::Adapter::ActionDispatch]
|
||||||
|
loaded_adapters << :default
|
||||||
|
loaded_adapters.each do |adapter|
|
||||||
define_method "test_#{adapter}_GET_retrieves_the_response_body" do
|
define_method "test_#{adapter}_GET_retrieves_the_response_body" do
|
||||||
assert_equal 'hello world', create_connection(adapter).get('hello_world').body
|
assert_equal 'hello world', create_connection(adapter).get('hello_world').body
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user