CafeHey
CafeHey

Reputation: 5820

In Rspec, how do I set the VCR record mode in the feature description?

I have a test that uses VCR like this:

describe 'Do something with an api', feature: true, js: true, vcr: true do end

I want to set this vcr recording to the option new_episodes (it's currently set to once) but I can't find out how to pass this option into the settings. How to I make this feature record with the setting new_episodes?

https://relishapp.com/vcr/vcr/v/2-9-3/docs/record-modes/new-episodes - here's the docs for this option.

I can do it when wrapping a block in a vcr recording, however I want to use this setting for one of my features, how do I go about doing that? Can I pass it in on the describe line?

Upvotes: 1

Views: 4330

Answers (1)

engineersmnky
engineersmnky

Reputation: 29498

2.9.3 is extremely old (current version appears to be 6.1.0).

That being said according to the docs, which show almost this exact example, you can pass that option through the :vcr key in the Hash

spec/spec_helper.rb

VCR.configure do |c| 
  c.configure_rspec_metadata!
end

And then

spec/your_spec.rb

describe 'Do something with an api', feature: true, js: true, vcr: {record: :new_episodes} do

Upvotes: 2

Related Questions