artemave
artemave

Reputation: 6946

Rspec metadata: vcr should only kick in for tagged examples, but works for every example instead?

Simple setup:

#spec_helper.rb

VCR.configure do |c|
  c.cassette_library_dir = File.expand_path '../vcr_cassettes', __FILE__
  c.hook_into :fakeweb
  c.ignore_localhost = true
  c.configure_rspec_metadata!
end

RSpec.configure do |c|
  c.treat_symbols_as_metadata_keys_with_true_values = true
end

I am expecting examples not tagged with :vcr to not be affected but that does not seem to be the case. I am getting "VCR does not know about request..." kind of error.

What am I missing?

Upvotes: 2

Views: 386

Answers (1)

Myron Marston
Myron Marston

Reputation: 21810

VCR is designed to help you identify all places in your test suite where HTTP requests are made and to help you get them under deterministic test. As such, by default, when an HTTP request is made and no cassette is in use, it raises an error. You can configure it to allow HTTP connections when there is no cassette if you prefer.

Upvotes: 3

Related Questions