diff --git a/features/steps/etc_steps.rb b/features/steps/etc_steps.rb index 79e7d07..719693a 100644 --- a/features/steps/etc_steps.rb +++ b/features/steps/etc_steps.rb @@ -1,5 +1,3 @@ -# FIXME: our monkey patch currently prevent us from using `must' in step -# definitions. -Then(/^the output should contain my current login name$/) do - assert_partial_output(Etc.getlogin, all_output) +Then /^the output must contain my current login name$/ do + assert_partial_output Etc.getlogin, all_output end diff --git a/features/steps/execution_steps.rb b/features/steps/execution_steps.rb new file mode 100644 index 0000000..796ad11 --- /dev/null +++ b/features/steps/execution_steps.rb @@ -0,0 +1,3 @@ +Then /^the exit status must be (\d+)$/ do |exit_status| + assert_exit_status exit_status.to_i +end diff --git a/features/steps/output_steps.rb b/features/steps/output_steps.rb new file mode 100644 index 0000000..3ad5a72 --- /dev/null +++ b/features/steps/output_steps.rb @@ -0,0 +1,23 @@ +Then /^the output must match \/([^\/]+)\/$/ do |pattern| + assert_matching_output pattern, all_output +end + +Then /^the output must contain "([^"]+)"$/ do |content| + assert_partial_output content, all_output +end + +Then /^the output must contain:$/ do |content| + assert_partial_output content, all_output +end + +Then /^the output must not contain "([^"]+)"$/ do |content| + assert_no_partial_output content, all_output +end + +Then /^the output must contain exactly "([^"]+)"$/ do |content| + assert_exact_output content, all_output +end + +Then /^the output must contain exactly:$/ do |content| + assert_exact_output content, all_output +end diff --git a/features/steps/recipe_steps.rb b/features/steps/recipe_steps.rb index 32b5810..6303ab1 100644 --- a/features/steps/recipe_steps.rb +++ b/features/steps/recipe_steps.rb @@ -1,16 +1,16 @@ -Given(/^a recipe with:$/) do |recipe_body| +Given /^a recipe with:$/ do |recipe_body| write_file 'recipe.rb', recipe_body end -When(/^I execute the recipe$/) do - run_simple('producer recipe.rb', false) +When /^I execute the recipe$/ do + run_simple 'producer recipe.rb', false end -When(/^I successfully execute the recipe$/) do +When /^I successfully execute the recipe$/ do step 'I execute the recipe' - assert_exit_status(0) + assert_exit_status 0 end -When(/^I execute the recipe interactively$/) do - run_interactive('producer recipe.rb') +When /^I execute the recipe interactively$/ do + run_interactive 'producer recipe.rb' end diff --git a/features/steps/remote_steps.rb b/features/steps/remote_steps.rb index 8e34b4a..2193335 100644 --- a/features/steps/remote_steps.rb +++ b/features/steps/remote_steps.rb @@ -10,14 +10,14 @@ Given /^a remote file named "([^"]+)" with "([^"]+)"$/ do |file_name, content| write_file file_name, content end -Then /^the remote directory "([^"]+)" should exists$/ do |path| - check_directory_presence([path], true) +Then /^the remote directory "([^"]+)" must exists$/ do |path| + check_directory_presence [path], true end -Then /^the remote file "([^"]+)" should contain "([^"]+)"/ do |path, content| +Then /^the remote file "([^"]+)" must contain "([^"]+)"$/ do |path, content| check_file_content path, content, true end -Then /^the remote file "([^"]+)" should contain exactly "([^"]+)"/ do |path, content| +Then /^the remote file "([^"]+)" must contain exactly "([^"]+)"$/ do |path, content| check_exact_file_content path, content end diff --git a/features/steps/ssh_steps.rb b/features/steps/ssh_steps.rb index 564b457..174293d 100644 --- a/features/steps/ssh_steps.rb +++ b/features/steps/ssh_steps.rb @@ -1,6 +1,6 @@ # FIXME: current home directory shouldn't be changed here, maybe we should use # a tag for features needing a fake home directory. -Given(/^an SSH config with:$/) do |config| - ENV['HOME'] = File.expand_path current_dir +Given /^an SSH config with:$/ do |config| + ENV['HOME'] = File.expand_path(current_dir) write_file '.ssh/config', config end diff --git a/features/support/env.rb b/features/support/env.rb index d6f0e68..668fcef 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,18 +1,2 @@ -module Cucumber - class Runtime - alias :old_step_match :step_match - - def step_match(step_name, name_to_report = nil) - if step_name.include? ' must ' - name_to_report = step_name.dup - step_name.gsub! ' must ', ' should ' - end - - old_step_match(step_name, name_to_report) - end - end -end - require 'aruba/cucumber' - require 'cucumber/sshd/cucumber'