Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

Just like features, scenarios can have multiline preambles. When
using the :use_scenario_name option, VCR will only use the first line
of the scenario name as the directory for the cassette. This change
is modeled after commit 034bdaf
  • Loading branch information...
commit 978f932a999b0e29b1d3c52f2d874d630699e298 1 parent 126c5af
Pascal Van Hecke authored
View
6 features/test_frameworks/cucumber.feature
@@ -92,6 +92,12 @@ Feature: Usage with Cucumber
@vcr
Scenario: tagged scenario
+
+ Note: Like the feature pre-amble, Cucumber treats the scenario pre-amble
+ as part of the scenario 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.
+
When a request is made to "http://localhost:7777/localhost_request_1"
Then the response should be "Hello localhost_request_1"
View
2  lib/vcr/test_frameworks/cucumber.rb
@@ -43,7 +43,7 @@ def tags(*tag_names)
feature = scenario.respond_to?(:scenario_outline) ? scenario.scenario_outline.feature : scenario.feature
name = feature.name.split("\n").first
name << "/#{scenario.scenario_outline.name}" if scenario.respond_to?(:scenario_outline)
- name << "/#{scenario.name}"
+ name << "/#{scenario.name.split("\n").first}"
name
else
"cucumber_tags/#{tag_name.gsub(/\A@/, '')}"
View
2  spec/vcr/test_frameworks/cucumber_spec.rb
@@ -9,7 +9,7 @@ def scenario(name)
stub(:name => name, :feature => stub(:name => "My feature name\nThe preamble text is not included"))
end
- let(:current_scenario) { scenario "My scenario name" }
+ let(:current_scenario) { scenario "My scenario name\nThe preamble text is not included" }
# define our own Before/After so we can test this in isolation from cucumber's implementation.
def Before(tag, &block)
Please sign in to comment.
Something went wrong with that request. Please try again.