Sha256: 9a444b57b19974126b9b214c84cca45c7cd03a6a399a5617599fd86d49ab90b7

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

shared_examples_for "version checking" do |library, options|
  file = options[:file] || "vcr/library_hooks/#{library.downcase}.rb"

  before(:each) do
    # ensure we don't get double callback registration by reloading the file...
    stub_callback_registration if respond_to?(:stub_callback_registration)
  end

  context 'when loading the library hook file', :disable_warnings => true do
    options[:valid].each do |version|
      it "does nothing when #{library}'s version is #{version}" do
        stub_version(version)
        Kernel.should_not_receive(:warn)
        expect { load file }.to_not raise_error
      end
    end

    options[:too_low].each do |version|
      it "raises an error when #{library}'s version is #{version}" do
        stub_version(version)
        Kernel.should_not_receive(:warn)
        expect { load file }.to raise_error(/You are using #{library} #{version}. VCR requires version/)
      end
    end

    options[:too_high].each do |version|
      it "does nothing when #{library}'s version is #{version}" do
        stub_version(version)
        Kernel.should_receive(:warn).with(/VCR is known to work with #{library}/)
        expect { load file }.to_not raise_error
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vcr-2.0.0.rc1 spec/support/shared_example_groups/version_checking.rb