myronmarston/vcr — Issue #140: Cucumber Meta Data
Author: cjolly
Created: 2012-03-01 09:59:07+00:00
State: open

Hi Myron,
First, VCR(2.0.0.rc2, 2.0.0.rc1) are working excellent for our project. We make extensive use of it, so thanks!

The rspec metadata integration is really cool. We had something hacked together that pulled that off in the past, but it's nice to see it officially supported.

We also do something similar for our Cucumber suite, as the scenario's metadata is available in the Before block. The cucumber tags feature you currently have is nice, but with a suite of a couple hundred scenarios, each dependent on a separate cassette, it's a bit unrealistic for a project like that.

Would you be open to a patch that implements an rspec-metadata-like interface for this, say scenarios tagged with @vcr-meta? If so, I'll gladly get a pull request together.

something along the lines of this pseudo-code in test_frameworks/cucumber.rb

````
def tags_with_cucumber_meta(tag_name = '@vcr-meta', options = {})
@main_object.Before(tag_name) do |scenario|
cassette_name = [scenario.feature.name.parameterize, scenario.description.parameterize].join('/')
VCR.insert_cassette(cassette_name, options)
end

@main_object.After(tag_name) do
VCR.eject_cassette
end
end
````