Refactor recipe execution in cucumber features

Mock home directory in `run_recipe' helper, avoid the need to use
@mocked_home_directory in many scenarios.
This commit is contained in:
Thibault Jouan 2015-04-06 08:47:46 +00:00
parent a3e75b0ac6
commit feef44b255
8 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
@sshd @mocked_home_directory @sshd
Feature: `file_append' task action Feature: `file_append' task action
Background: Background:

View File

@ -1,4 +1,4 @@
@sshd @mocked_home_directory @sshd
Feature: `file_replace_content' task action Feature: `file_replace_content' task action
Background: Background:

View File

@ -1,4 +1,4 @@
@sshd @mocked_home_directory @sshd
Feature: `file_write' task action Feature: `file_write' task action
Background: Background:

View File

@ -1,4 +1,4 @@
@sshd @mocked_home_directory @sshd
Feature: `mkdir' task action Feature: `mkdir' task action
Background: Background:

View File

@ -1,4 +1,4 @@
@sshd @mocked_home_directory @sshd
Feature: `sh' task action Feature: `sh' task action
Scenario: forwards standard ouput Scenario: forwards standard ouput

View File

@ -1,4 +1,4 @@
@sshd @mocked_home_directory @sshd
Feature: `yaml_write' task action Feature: `yaml_write' task action
Background: Background:

View File

@ -18,7 +18,7 @@ Feature: `test_macro' recipe keyword
Then the output must contain "2" Then the output must contain "2"
And the output must not contain "1" And the output must not contain "1"
@sshd @mocked_home_directory @sshd
Scenario: has access to core tests Scenario: has access to core tests
Given a recipe with: Given a recipe with:
""" """

View File

@ -7,7 +7,9 @@ def run_recipe(remote: false, options: nil, check: false, rargv: nil)
command << options if options command << options if options
command << ['--', *rargv] if rargv command << ['--', *rargv] if rargv
with_env 'HOME' => File.expand_path(current_dir) do
run_simple command.join(' '), false run_simple command.join(' '), false
end
assert_exit_status 0 if check assert_exit_status 0 if check
assert_matching_output '\ASocketError', all_output if remote == :unknown assert_matching_output '\ASocketError', all_output if remote == :unknown