Sha256: c6e0df11b8114c47c06ff08215da5c98ac45fac7e35d9b2ee425d7439c721f9d

Contents?: true

Size: 1.51 KB

Versions: 18

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe VCR::RSpec::Macros do
  extend described_class

  describe '#use_vcr_cassette' do
    def self.perform_test(context_name, expected_cassette_name, *args, &block)
      context context_name do
        after(:each) do
          if @test_ejection
            VCR.current_cassette.should be_nil
          end
        end

        use_vcr_cassette *args

        it 'ejects the cassette in an after hook' do
          VCR.current_cassette.should be_a(VCR::Cassette)
          @test_ejection = true
        end

        it "creates a cassette named '#{expected_cassette_name}" do
          VCR.current_cassette.name.should == expected_cassette_name
        end

        module_eval(&block) if block
      end
    end

    perform_test 'when called with an explicit name', 'explicit_name', 'explicit_name'

    perform_test 'when called with an explicit name and some options', 'explicit_name', 'explicit_name', :match_requests_on => [:method, :host] do
      it 'uses the provided cassette options' do
        VCR.current_cassette.match_requests_on.should == [:method, :host]
      end
    end

    perform_test 'when called with nothing', 'VCR::RSpec::Macros/#use_vcr_cassette/when called with nothing'

    perform_test 'when called with some options', 'VCR::RSpec::Macros/#use_vcr_cassette/when called with some options', :match_requests_on => [:method, :host] do
      it 'uses the provided cassette options' do
        VCR.current_cassette.match_requests_on.should == [:method, :host]
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
vcr-1.11.1 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.10.3 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.10.2 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.10.0 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.9.0 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.8.0 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.7.2 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.7.1 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.7.0 spec/vcr/test_frameworks/rspec_spec.rb
vcr-1.6.0 spec/vcr/rspec_spec.rb
vcr-1.5.1 spec/vcr/rspec_spec.rb
vcr-1.5.0 spec/vcr/rspec_spec.rb
vcr-1.4.0 spec/rspec_spec.rb
vcr-1.3.3 spec/rspec_spec.rb
vcr-1.3.2 spec/rspec_spec.rb
vcr-1.3.1 spec/rspec_spec.rb
vcr-1.3.0 spec/rspec_spec.rb
vcr-1.2.0 spec/rspec_spec.rb