Remove cucumber monkey patch translating steps:
It was initially added to allow reuse of aruba cucumber steps, using `must' instead of `should'. This is creating more harm than good, hence we remove it and implements all missing steps, using aruba API.
This commit is contained in:
parent
974e0aca73
commit
9323391161
@ -1,5 +1,3 @@
|
|||||||
# FIXME: our monkey patch currently prevent us from using `must' in step
|
Then /^the output must contain my current login name$/ do
|
||||||
# definitions.
|
assert_partial_output Etc.getlogin, all_output
|
||||||
Then(/^the output should contain my current login name$/) do
|
|
||||||
assert_partial_output(Etc.getlogin, all_output)
|
|
||||||
end
|
end
|
||||||
|
3
features/steps/execution_steps.rb
Normal file
3
features/steps/execution_steps.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
Then /^the exit status must be (\d+)$/ do |exit_status|
|
||||||
|
assert_exit_status exit_status.to_i
|
||||||
|
end
|
23
features/steps/output_steps.rb
Normal file
23
features/steps/output_steps.rb
Normal file
@ -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
|
@ -1,16 +1,16 @@
|
|||||||
Given(/^a recipe with:$/) do |recipe_body|
|
Given /^a recipe with:$/ do |recipe_body|
|
||||||
write_file 'recipe.rb', recipe_body
|
write_file 'recipe.rb', recipe_body
|
||||||
end
|
end
|
||||||
|
|
||||||
When(/^I execute the recipe$/) do
|
When /^I execute the recipe$/ do
|
||||||
run_simple('producer recipe.rb', false)
|
run_simple 'producer recipe.rb', false
|
||||||
end
|
end
|
||||||
|
|
||||||
When(/^I successfully execute the recipe$/) do
|
When /^I successfully execute the recipe$/ do
|
||||||
step 'I execute the recipe'
|
step 'I execute the recipe'
|
||||||
assert_exit_status(0)
|
assert_exit_status 0
|
||||||
end
|
end
|
||||||
|
|
||||||
When(/^I execute the recipe interactively$/) do
|
When /^I execute the recipe interactively$/ do
|
||||||
run_interactive('producer recipe.rb')
|
run_interactive 'producer recipe.rb'
|
||||||
end
|
end
|
||||||
|
@ -10,14 +10,14 @@ Given /^a remote file named "([^"]+)" with "([^"]+)"$/ do |file_name, content|
|
|||||||
write_file file_name, content
|
write_file file_name, content
|
||||||
end
|
end
|
||||||
|
|
||||||
Then /^the remote directory "([^"]+)" should exists$/ do |path|
|
Then /^the remote directory "([^"]+)" must exists$/ do |path|
|
||||||
check_directory_presence([path], true)
|
check_directory_presence [path], true
|
||||||
end
|
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
|
check_file_content path, content, true
|
||||||
end
|
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
|
check_exact_file_content path, content
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# FIXME: current home directory shouldn't be changed here, maybe we should use
|
# FIXME: current home directory shouldn't be changed here, maybe we should use
|
||||||
# a tag for features needing a fake home directory.
|
# a tag for features needing a fake home directory.
|
||||||
Given(/^an SSH config with:$/) do |config|
|
Given /^an SSH config with:$/ do |config|
|
||||||
ENV['HOME'] = File.expand_path current_dir
|
ENV['HOME'] = File.expand_path(current_dir)
|
||||||
write_file '.ssh/config', config
|
write_file '.ssh/config', config
|
||||||
end
|
end
|
||||||
|
@ -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 'aruba/cucumber'
|
||||||
|
|
||||||
require 'cucumber/sshd/cucumber'
|
require 'cucumber/sshd/cucumber'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user