Sha256: f786b90d8abad0da011f882f588a61b45f0c29d70e2723b623e752551a156628

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe VCR::HttpStubbingAdapters::WebMock do
  it_should_behave_like 'an http stubbing adapter',
    %w[net/http patron httpclient em-http-request],
    [:method, :uri, :host, :path, :body, :headers]

  describe '#check_version!' do
    before(:each) { WebMock.should respond_to(:version) }

    %w( 0.9.9 0.9.10 0.1.30 1.0.30 1.2.9 1.3.2 ).each do |version|
      it "raises an error when WebMock's version is #{version}" do
        WebMock.stub!(:version).and_return(version)
        described_class.should_not_receive(:warn)
        expect { described_class.check_version! }.to raise_error(/You are using WebMock #{version}.  VCR requires version .* or greater/)
      end
    end

    %w( 1.3.3 1.3.10 1.3.99 ).each do |version|
      it "does nothing when WebMock's version is #{version}" do
        WebMock.stub!(:version).and_return(version)
        described_class.should_not_receive(:warn)
        expect { described_class.check_version! }.to_not raise_error
      end
    end

    %w( 1.4.0 1.10.0 2.0.0 ).each do |version|
      it "does nothing when WebMock's version is #{version}" do
        WebMock.stub!(:version).and_return(version)
        described_class.should_receive(:warn).with(/VCR is known to work with WebMock ~> .*\./)
        expect { described_class.check_version! }.to_not raise_error
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vcr-1.1.1 spec/http_stubbing_adapters/webmock_spec.rb