diff --git a/Gemfile b/Gemfile index 7f629e55..114f22b7 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,6 @@ gem 'appraisal' gem 'typhoeus', :git => "https://github.com/typhoeus/typhoeus.git" gem 'webmock', :git => "https://github.com/i0rek/webmock.git", :branch => "typhoeus_0.5.0" -gem 'faraday', :git => "https://github.com/i0rek/faraday.git", :branch => "typhoeus_0.5.0" gemspec diff --git a/features/configuration/hook_into.feature b/features/configuration/hook_into.feature index 6d5cefaf..b7b14981 100644 --- a/features/configuration/hook_into.feature +++ b/features/configuration/hook_into.feature @@ -96,6 +96,7 @@ Feature: hook_into require 'excon' require 'faraday' require 'vcr' + VCR.configure { |c| c.ignore_localhost = true } @@ -167,8 +168,8 @@ Feature: hook_into | Faraday 2: Hello faraday | Examples: - | hook_into | faraday_adapter | - | :fakeweb | net_http | - | :webmock | net_http | - | :fakeweb | typhoeus | - | :webmock | typhoeus | + | hook_into | faraday_adapter | extra_require | + | :fakeweb | net_http | | + | :webmock | net_http | | + | :fakeweb | typhoeus | require 'typhoeus/adapters/faraday' | + | :webmock | typhoeus | require 'typhoeus/adapters/faraday' | diff --git a/features/middleware/faraday.feature b/features/middleware/faraday.feature index b6e28c02..a6d8b9f1 100644 --- a/features/middleware/faraday.feature +++ b/features/middleware/faraday.feature @@ -21,6 +21,7 @@ Feature: Faraday middleware require 'faraday' require 'vcr' + VCR.configure do |c| c.default_cassette_options = { :serialize_with => :syck } @@ -49,7 +50,7 @@ Feature: Faraday middleware And the file "cassettes/example.yml" should contain "Hello foo 1" Examples: - | adapter | - | net_http | - | typhoeus | + | adapter | extra_require | + | net_http | | + | typhoeus | require 'typhoeus/adapters/faraday' | diff --git a/features/support/vcr_cucumber_helpers.rb b/features/support/vcr_cucumber_helpers.rb index 9bfd1d92..8bbd6ad3 100644 --- a/features/support/vcr_cucumber_helpers.rb +++ b/features/support/vcr_cucumber_helpers.rb @@ -23,8 +23,9 @@ def available?; true; end end def include_http_adapter_for(lib) - require 'support/http_library_adapters' require (lib =~ /faraday/ ? 'faraday' : lib) + require 'typhoeus' if lib.include?('typhoeus') # for faraday-typhoeus + require 'support/http_library_adapters' include HTTP_LIBRARY_ADAPTERS[lib] end diff --git a/gemfiles/typhoeus-new.gemfile b/gemfiles/typhoeus-new.gemfile index 4e73598a..f01b635d 100644 --- a/gemfiles/typhoeus-new.gemfile +++ b/gemfiles/typhoeus-new.gemfile @@ -4,7 +4,6 @@ source :rubygems gem "appraisal" gem "webmock", :git=>"https://github.com/i0rek/webmock.git", :branch=>"typhoeus_0.5.0" -gem "faraday", :git=>"https://github.com/i0rek/faraday.git", :branch=>"typhoeus_0.5.0" gem "jruby-openssl", :platforms=>:jruby gem "yard" gem "relish", "~> 0.6" diff --git a/gemfiles/typhoeus-new.gemfile.lock b/gemfiles/typhoeus-new.gemfile.lock index feb3da20..b8e478f7 100644 --- a/gemfiles/typhoeus-new.gemfile.lock +++ b/gemfiles/typhoeus-new.gemfile.lock @@ -1,11 +1,3 @@ -GIT - remote: https://github.com/i0rek/faraday.git - revision: 69a2fa65e3a37e1fe9e8a2e4c900d79a3bc0546a - branch: typhoeus_0.5.0 - specs: - faraday (0.9.0.pre) - multipart-post (~> 1.1) - GIT remote: https://github.com/i0rek/webmock.git revision: aeac5cc6a1ac7a313c138514d66cd536802b9dc4 @@ -17,10 +9,10 @@ GIT GIT remote: https://github.com/typhoeus/typhoeus.git - revision: 73ef1a00c2615cf77e92591c1efd885ffafb16b6 + revision: 6f4e9079ade2f90c20341dddd022ab1d153400ec specs: typhoeus (0.5.0.rc) - ethon (= 0.5.0) + ethon (= 0.5.1) PATH remote: /Users/myron/code/vcr @@ -40,8 +32,8 @@ GEM cucumber (>= 1.1.1) ffi (>= 1.0.11) rspec (>= 2.7.0) - builder (3.1.3) - childprocess (0.3.5) + builder (3.1.4) + childprocess (0.3.6) ffi (~> 1.0, >= 1.0.6) columnize (0.3.6) cookiejar (0.3.0) @@ -69,12 +61,14 @@ GEM http_parser.rb (>= 0.5.3) em-socksify (0.2.1) eventmachine (>= 1.0.0.beta.4) - ethon (0.5.0) + ethon (0.5.1) ffi (~> 1.0.11) mime-types (~> 1.18) eventmachine (1.0.0) - excon (0.16.4) + excon (0.16.7) fakeweb (1.3.0) + faraday (0.8.4) + multipart-post (~> 1.1) ffi (1.0.11) fuubar (1.0.0) rspec (~> 2.0) @@ -136,7 +130,7 @@ GEM tilt (1.3.3) timecop (0.3.5) yajl-ruby (1.1.0) - yard (0.8.2.1) + yard (0.8.3) PLATFORMS ruby @@ -151,7 +145,7 @@ DEPENDENCIES em-http-request (~> 1.0.2) excon (>= 0.11.0, < 1.0) fakeweb (~> 1.3.0) - faraday! + faraday (~> 0.8) fuubar fuubar-cucumber github-markup diff --git a/gemfiles/typhoeus-old.gemfile b/gemfiles/typhoeus-old.gemfile index 45f33d72..3c2ce12c 100644 --- a/gemfiles/typhoeus-old.gemfile +++ b/gemfiles/typhoeus-old.gemfile @@ -3,7 +3,6 @@ source :rubygems gem "appraisal" -gem "faraday", :git=>"https://github.com/i0rek/faraday.git", :branch=>"typhoeus_0.5.0" gem "jruby-openssl", :platforms=>:jruby gem "yard" gem "relish", "~> 0.6" diff --git a/gemfiles/typhoeus-old.gemfile.lock b/gemfiles/typhoeus-old.gemfile.lock index a14b30f4..79fb54bd 100644 --- a/gemfiles/typhoeus-old.gemfile.lock +++ b/gemfiles/typhoeus-old.gemfile.lock @@ -1,11 +1,3 @@ -GIT - remote: https://github.com/i0rek/faraday.git - revision: 69a2fa65e3a37e1fe9e8a2e4c900d79a3bc0546a - branch: typhoeus_0.5.0 - specs: - faraday (0.9.0.pre) - multipart-post (~> 1.1) - PATH remote: /Users/myron/code/vcr specs: @@ -24,8 +16,8 @@ GEM cucumber (>= 1.1.1) ffi (>= 1.0.11) rspec (>= 2.7.0) - builder (3.1.3) - childprocess (0.3.5) + builder (3.1.4) + childprocess (0.3.6) ffi (~> 1.0, >= 1.0.6) columnize (0.3.6) cookiejar (0.3.0) @@ -54,8 +46,10 @@ GEM em-socksify (0.2.1) eventmachine (>= 1.0.0.beta.4) eventmachine (1.0.0) - excon (0.16.4) + excon (0.16.7) fakeweb (1.3.0) + faraday (0.8.4) + multipart-post (~> 1.1) ffi (1.1.5) fuubar (1.0.0) rspec (~> 2.0) @@ -123,7 +117,7 @@ GEM addressable (>= 2.2.7) crack (>= 0.1.7) yajl-ruby (1.1.0) - yard (0.8.2.1) + yard (0.8.3) PLATFORMS ruby @@ -138,7 +132,7 @@ DEPENDENCIES em-http-request (~> 1.0.2) excon (>= 0.11.0, < 1.0) fakeweb (~> 1.3.0) - faraday! + faraday (~> 0.8) fuubar fuubar-cucumber github-markup diff --git a/spec/support/http_library_adapters.rb b/spec/support/http_library_adapters.rb index e2615fe2..84196118 100644 --- a/spec/support/http_library_adapters.rb +++ b/spec/support/http_library_adapters.rb @@ -219,6 +219,12 @@ def normalize_request_headers(headers) end %w[ net_http typhoeus patron ].each do |_faraday_adapter| + if _faraday_adapter == 'typhoeus' && + defined?(::Typhoeus::VERSION) && + ::Typhoeus::VERSION.to_f >= 0.5 + require 'typhoeus/adapters/faraday' + end + HTTP_LIBRARY_ADAPTERS["faraday (w/ #{_faraday_adapter})"] = Module.new do class << self; self; end.class_eval do define_method(:http_library_name) do diff --git a/spec/support/shared_example_groups/hook_into_http_library.rb b/spec/support/shared_example_groups/hook_into_http_library.rb index 8e83878f..5e7aab02 100644 --- a/spec/support/shared_example_groups/hook_into_http_library.rb +++ b/spec/support/shared_example_groups/hook_into_http_library.rb @@ -56,7 +56,7 @@ def self.test_record_and_playback(description, query) test_record_and_playback "with a complex escaped query param", "q=#{CGI.escape("A&(! 234k !@ kasdj232\#$ kjw35")}" it 'plays back an empty body response exactly as it was recorded (e.g. nil vs empty string)' do - pending "awaiting an external fix", :if => library_hook_name == :fakeweb do + pending "awaiting an external fix", :if => library.gsub('_', '/').include?('net/http') && library_hook_name != :webmock do get_body = lambda do VCR.use_cassette('empty_body', :record => :once) do get_body_object make_http_request(:get, "http://localhost:#{VCR::SinatraApp.port}/204")