features/lib/step_definitions/cucumber_steps.rb in cucumber-2.3.3 vs features/lib/step_definitions/cucumber_steps.rb in cucumber-2.4.0
- old
+ new
@@ -30,9 +30,37 @@
Given /^a step definition that looks like this:$/ do |string|
create_step_definition { string }
end
+Given /^a scenario "([^\"]*)" that passes$/ do |name|
+ write_file "features/#{name}.feature",
+ <<-FEATURE
+ Feature: #{name}
+ Scenario: #{name}
+ Given it passes
+ FEATURE
+
+ write_file "features/step_definitions/#{name}_steps.rb",
+ <<-STEPS
+ Given(/^it passes$/) { expect(true).to be true }
+ STEPS
+end
+
+Given /^a scenario "([^\"]*)" that fails$/ do |name|
+ write_file "features/#{name}.feature",
+ <<-FEATURE
+ Feature: #{name}
+ Scenario: #{name}
+ Given it fails
+ FEATURE
+
+ write_file "features/step_definitions/#{name}_steps.rb",
+ <<-STEPS
+ Given(/^it fails$/) { expect(false).to be true }
+ STEPS
+end
+
When /^I run the feature with the (\w+) formatter$/ do |formatter|
expect(features.length).to eq 1
run_feature features.first, formatter
end