Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update faraday version in gemspec #794

Merged
merged 3 commits into from
Feb 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" \
d-m-u marked this conversation as resolved.
Show resolved Hide resolved
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
Copy link

@jrafanie jrafanie Feb 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✂️ Nice! Yeah, agreed. This test is no longer valid with faraday 1.0.0 as the warning doesn't happen because the adapter is managed differently now.

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm late to this PR, was it failing on master because of this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


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