Skip to content

Commit

Permalink
Update faraday version in gemspec (vcr#794)
Browse files Browse the repository at this point in the history
* Update faraday version in gemspec

* Fix specs
  • Loading branch information
d-m-u authored Feb 8, 2020
1 parent d9f16c2 commit a61ce03
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Gemfile.faraday-0.11 → Gemfile.faraday-1.0.0
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

gem "faraday", "~> 0.11.0"
gem "faraday", "~> 1.0.0"

gemspec

Expand Down
2 changes: 1 addition & 1 deletion script/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ if [ "$RUBY_ENGINE" = "ruby" ]; then
run script/test spec/lib/vcr/library_hooks/typhoeus_0.4_spec.rb
fi

BUNDLE_GEMFILE=Gemfile.faraday-0.11 fold "faraday-0.11" \
BUNDLE_GEMFILE=Gemfile.faraday-1.0.0 fold "faraday-1.0.0" \
run script/test spec/lib/vcr/middleware/faraday_spec.rb spec/lib/vcr/library_hooks/faraday_spec.rb \
features/middleware/faraday.feature

Expand Down
28 changes: 3 additions & 25 deletions spec/lib/vcr/library_hooks/faraday_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,23 @@
end

conn.builder.lock!
expect(conn.builder.handlers.last(2).map(&:klass)).to eq([
VCR::Middleware::Faraday,
Faraday::Adapter::NetHttp
])
expect(conn.builder.handlers.last.klass).to eq(VCR::Middleware::Faraday)
end

it 'handles the case where no adapter is declared' do
conn = Faraday.new

conn.builder.lock!
expect(conn.builder.handlers.last(2).map(&:klass)).to eq([
VCR::Middleware::Faraday,
Faraday::Adapter::NetHttp
])
expect(conn.builder.handlers.last.klass).to eq(VCR::Middleware::Faraday)
end

it 'does nothing if the VCR middleware has already been included' do
conn = Faraday.new(:url => 'http://sushi.com') do |builder|
builder.use VCR::Middleware::Faraday
builder.use Faraday::Response::Logger
builder.use Faraday::Adapter::NetHttp
end

conn.builder.lock!
expect(conn.builder.handlers.map(&:klass)).to eq([
VCR::Middleware::Faraday,
Faraday::Response::Logger,
Faraday::Adapter::NetHttp
])
end

it 'prints a warning if the faraday connection stack contains a middleware after the HTTP adapter' do
conn = Faraday.new(:url => 'http://sushi.com') do |builder|
builder.use Faraday::Adapter::NetHttp
builder.use Faraday::Response::Logger
end

expect(conn.builder).to receive(:warn).with(/Faraday::Response::Logger/)
conn.builder.lock!
expect(conn.builder.handlers).to eq([VCR::Middleware::Faraday])
end

it 'gracefully handles the case where there is no explicit HTTP adapter' do
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
require 'simplecov'
SimpleCov.start

require "pry"
require "rspec"
Expand Down
2 changes: 1 addition & 1 deletion vcr.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "hashdiff", ">= 1.0.0.beta1", "< 2.0.0"
spec.add_development_dependency "cucumber", "~> 2.0.2"
spec.add_development_dependency "aruba", "~> 0.14.12"
spec.add_development_dependency "faraday", "~> 0.11.0"
spec.add_development_dependency "faraday", ">= 0.11.0", "< 2.0.0"
spec.add_development_dependency "httpclient"
spec.add_development_dependency "excon", "0.62.0"
spec.add_development_dependency "timecop"
Expand Down

0 comments on commit a61ce03

Please sign in to comment.