fix live tests

This commit is contained in:
rick 2010-09-07 15:20:24 -07:00
parent cc64429c76
commit bc2cd52f70
3 changed files with 6 additions and 3 deletions

View File

@ -42,7 +42,8 @@ module Faraday
end
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

View File

@ -20,7 +20,6 @@ module Faraday
def call(env)
super
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])
resp = @session.response
env.update \

View File

@ -3,7 +3,10 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', 'helper'))
if Faraday::TestCase::LIVE_SERVER
module Adapters
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
assert_equal 'hello world', create_connection(adapter).get('hello_world').body
end