RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: ujh
Site: http://bettong.net
This still doesn't work when you have cucumber backgrounds as the around hook gets executed after (!) the background is executed.
This is a great start. However, it doesn't work with Scenario Outlines. The following does however:
Around('@vcr') do |scenario, block| s_name = scenario.name.underscore.gsub(/[^\w]+/, "_").gsub(/^_/,'').gsub(/_$/,'') if scenario.respond_to? :scenario_outline feature = scenario.scenario_outline.feature else feature = scenario.feature end f_name = feature.name.underscore.gsub(/[^\w\/]+/, "_") VCR.use_cassette("/#{f_name}/#{s_name}", record: :once) { block.call } end
This still doesn't work when you have cucumber backgrounds as the around hook gets executed after (!) the background is executed.
This is a great start. However, it doesn't work with Scenario Outlines. The following does however: