Browse files

Only use the first line of the cuke feature name in the cassette name.

Closes #157.
  • Loading branch information...
1 parent dbe142d commit 034bdaf6935cfc482b807171e0c677f3a967224b @myronmarston committed Apr 23, 2012
View
4 features/test_frameworks/cucumber.feature
@@ -75,6 +75,10 @@ Feature: Usage with Cucumber
"""
Feature: VCR example
+ Note: Cucumber treats the pre-amble as part of the feature name. When
+ using the :use_scenario_name option, VCR will only use the first line
+ of the feature name as the directory for the cassette.
+
@localhost_request
Scenario: tagged scenario
When a request is made to "http://localhost:7777/localhost_request_1"
View
2 lib/vcr/test_frameworks/cucumber.rb
@@ -38,7 +38,7 @@ def tags(*tag_names)
options = original_options.dup
cassette_name = if options.delete(:use_scenario_name)
- "#{scenario.feature.name}/#{scenario.name}"
+ "#{scenario.feature.name.split("\n").first}/#{scenario.name}"
else
"cucumber_tags/#{tag_name.gsub(/\A@/, '')}"
end
View
2 spec/vcr/test_frameworks/cucumber_spec.rb
@@ -6,7 +6,7 @@
let(:after_blocks_for_tags) { {} }
def scenario(name)
- stub(:name => name, :feature => stub(:name => "My feature name"))
+ stub(:name => name, :feature => stub(:name => "My feature name\nThe preamble text is not included"))
end
let(:current_scenario) { scenario "My scenario name" }

0 comments on commit 034bdaf

Please sign in to comment.