Skip to content

Commit

Permalink
Only use the first line of the cuke feature name in the cassette name.
Browse files Browse the repository at this point in the history
Closes vcr#157.
  • Loading branch information
myronmarston committed Apr 24, 2012
1 parent dbe142d commit 034bdaf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions features/test_frameworks/cucumber.feature
Expand Up @@ -75,6 +75,10 @@ Feature: Usage with Cucumber
""" """
Feature: VCR example 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 @localhost_request
Scenario: tagged scenario Scenario: tagged scenario
When a request is made to "http://localhost:7777/localhost_request_1" When a request is made to "http://localhost:7777/localhost_request_1"
Expand Down
2 changes: 1 addition & 1 deletion lib/vcr/test_frameworks/cucumber.rb
Expand Up @@ -38,7 +38,7 @@ def tags(*tag_names)
options = original_options.dup options = original_options.dup


cassette_name = if options.delete(:use_scenario_name) cassette_name = if options.delete(:use_scenario_name)
"#{scenario.feature.name}/#{scenario.name}" "#{scenario.feature.name.split("\n").first}/#{scenario.name}"
else else
"cucumber_tags/#{tag_name.gsub(/\A@/, '')}" "cucumber_tags/#{tag_name.gsub(/\A@/, '')}"
end end
Expand Down
2 changes: 1 addition & 1 deletion spec/vcr/test_frameworks/cucumber_spec.rb
Expand Up @@ -6,7 +6,7 @@
let(:after_blocks_for_tags) { {} } let(:after_blocks_for_tags) { {} }


def scenario(name) 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 end


let(:current_scenario) { scenario "My scenario name" } let(:current_scenario) { scenario "My scenario name" }
Expand Down

0 comments on commit 034bdaf

Please sign in to comment.