Sha256: 70c6211f51400e8b97924fb96c94b566604262790a8d5f4775c3117be9df2b77

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

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

  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

2 entries across 2 versions & 1 rubygems

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