Sha256: 44d6065404199c62ae3f252d9981d4c7a8cebb2fe4d00d3721fac5718ee4c0b2

Contents?: true

Size: 847 Bytes

Versions: 5

Compression:

Stored size: 847 Bytes

Contents

require 'spec_helper'

describe "WebMock hook", :with_monkey_patches => :webmock do
  after(:each) do
    ::WebMock.reset!
  end

  def disable_real_connections
    ::WebMock.disable_net_connect!
    ::WebMock::NetConnectNotAllowedError
  end

  def enable_real_connections
    ::WebMock.allow_net_connect!
  end

  def directly_stub_request(method, url, response_body)
    ::WebMock.stub_request(method, url).to_return(:body => response_body)
  end

  %w[net/http patron httpclient em-http-request curb typhoeus excon].each do |lib|
    other = []
    other << :status_message_not_exposed if lib == 'excon'
    it_behaves_like 'a hook into an HTTP library', :webmock, lib, *other do
      if lib == 'net/http'
        def normalize_request_headers(headers)
          headers.merge(DEFAULT_REQUEST_HEADERS)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vcr-2.1.1 spec/vcr/library_hooks/webmock_spec.rb
vcr-2.1.0 spec/vcr/library_hooks/webmock_spec.rb
vcr-2.0.1 spec/vcr/library_hooks/webmock_spec.rb
vcr-2.0.0 spec/vcr/library_hooks/webmock_spec.rb
vcr-2.0.0.rc2 spec/vcr/library_hooks/webmock_spec.rb