features/lib/step_definitions/cucumber_steps.rb in cucumber-3.0.0.pre.1 vs features/lib/step_definitions/cucumber_steps.rb in cucumber-3.0.0.pre.2
- old
+ new
@@ -1,25 +1,25 @@
# frozen_string_literal: true
-Given /^a directory without standard Cucumber project directory structure$/ do
+Given('a directory without standard Cucumber project directory structure') do
in_current_dir do
FileUtils.rm_rf 'features' if File.directory?('features')
end
end
-Given /^a scenario with a step that looks like this:$/ do |string|
+Given('a scenario with a step that looks like this:') do |string|
create_feature do
create_scenario { string }
end
end
-Given(/^a scenario with a step that looks like this in japanese:$/) do |string|
+Given('a scenario with a step that looks like this in japanese:') do |string|
create_feature_ja do
create_scenario_ja { string }
end
end
-Given(/^the standard step definitions$/) do
+Given('the standard step definitions') do
write_file 'features/step_definitions/steps.rb',
<<-STEPS
Given(/^this step passes$/) { }
Given(/^this step raises an error$/) { raise 'error' }
@@ -27,15 +27,15 @@
Given(/^this step fails$/) { fail }
Given(/^this step is a table step$/) {|t| }
STEPS
end
-Given /^a step definition that looks like this:$/ do |string|
+Given('a step definition that looks like this:') do |string|
create_step_definition { string }
end
-Given /^a scenario "([^\"]*)" that passes$/ do |name|
+Given('a scenario {string} that passes') do |name|
write_file "features/#{name}.feature",
<<-FEATURE
Feature: #{name}
Scenario: #{name}
Given it passes
@@ -45,11 +45,11 @@
<<-STEPS
Given(/^it passes$/) { expect(true).to be true }
STEPS
end
-Given /^a scenario "([^\"]*)" that fails$/ do |name|
+Given('a scenario {string} that fails') do |name|
write_file "features/#{name}.feature",
<<-FEATURE
Feature: #{name}
Scenario: #{name}
Given it fails
@@ -59,16 +59,12 @@
<<-STEPS
Given(/^it fails$/) { expect(false).to be true }
STEPS
end
-When /^I run the feature with the (\w+) formatter$/ do |formatter|
+When(/^I run the feature with the (\w+) formatter$/) do |formatter|
expect(features.length).to eq 1
run_feature features.first, formatter
-end
-
-Then /^the stderr should contain a warning message$/ do
- expect(all_stderr).to include("[warning]")
end
module CucumberHelper
def run_feature(filename = 'features/a_feature.feature', formatter = 'progress')
run_simple "#{Cucumber::BINARY} #{filename} --format #{formatter}", false