Sha256: bd646ac2e82b8f1abd34ef2134d5e002af8d6a5a5a3dc621e57734402f5ffaad
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
require 'spec_helper' require 'vcr/library_hooks/faraday' describe "Faraday hook" do it 'inserts the VCR middleware just before the adapter' do conn = Faraday.new(:url => 'http://sushi.com') do |builder| builder.request :url_encoded builder.request :json builder.response :logger builder.adapter :net_http end conn.builder.lock! conn.builder.handlers.last(2).map(&:klass).should eq([ VCR::Middleware::Faraday, Faraday::Adapter::NetHttp ]) end it 'handles the case where no adapter is declared' do conn = Faraday.new conn.builder.lock! conn.builder.handlers.last(2).map(&:klass).should eq([ VCR::Middleware::Faraday, Faraday::Adapter::NetHttp ]) 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! conn.builder.handlers.map(&:klass).should eq([ VCR::Middleware::Faraday, Faraday::Response::Logger, Faraday::Adapter::NetHttp ]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vcr-2.0.0.rc2 | spec/vcr/library_hooks/faraday_spec.rb |
vcr-2.0.0.rc1 | spec/vcr/library_hooks/faraday_spec.rb |