Unflatten features directory tree
This commit is contained in:
11
features/actions/echo.feature
Normal file
11
features/actions/echo.feature
Normal file
@@ -0,0 +1,11 @@
|
||||
Feature: `echo' task action
|
||||
|
||||
Scenario: prints text on standard output
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :echo_action do
|
||||
echo 'hello'
|
||||
end
|
||||
"""
|
||||
When I successfully execute the recipe
|
||||
Then the output must match /\Ahello\n/
|
15
features/actions/file_append.feature
Normal file
15
features/actions/file_append.feature
Normal file
@@ -0,0 +1,15 @@
|
||||
@sshd
|
||||
Feature: `file_append' task action
|
||||
|
||||
Background:
|
||||
Given a remote file named "some_file" with "some content"
|
||||
|
||||
Scenario: appends given content to requested file
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :file_append_action do
|
||||
file_append 'some_file', ' added'
|
||||
end
|
||||
"""
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote file "some_file" must contain exactly "some content added"
|
24
features/actions/file_replace_content.feature
Normal file
24
features/actions/file_replace_content.feature
Normal file
@@ -0,0 +1,24 @@
|
||||
@sshd
|
||||
Feature: `file_replace_content' task action
|
||||
|
||||
Background:
|
||||
Given a remote file named "some_file" with "some content"
|
||||
And a remote file named "other_file" with "some content"
|
||||
And a recipe with:
|
||||
"""
|
||||
task :file_replace_content_action_string do
|
||||
file_replace_content 'some_file', 'content', 'other content'
|
||||
end
|
||||
|
||||
task :file_replace_content_action_regexp do
|
||||
file_replace_content 'other_file', /\w+\z/, 'other content'
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: replaces a string by another in the requested file
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote file "some_file" must contain exactly "some other content"
|
||||
|
||||
Scenario: replaces a regular expression by a string in the requested file
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote file "other_file" must contain exactly "some other content"
|
21
features/actions/file_write.feature
Normal file
21
features/actions/file_write.feature
Normal file
@@ -0,0 +1,21 @@
|
||||
@sshd
|
||||
Feature: `file_write' task action
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :file_write_action do
|
||||
file_write 'some_file', 'some_content'
|
||||
file_write 'some_file_0600', 'some_content', mode: 0600
|
||||
file_write 'some_file_0700', 'some_content', mode: 0700
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: writes given data to given file path
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote file "some_file" must contain "some_content"
|
||||
|
||||
Scenario: creates file with given permissions
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote file "some_file_0600" must have 0600 mode
|
||||
And the remote file "some_file_0700" must have 0700 mode
|
31
features/actions/mkdir.feature
Normal file
31
features/actions/mkdir.feature
Normal file
@@ -0,0 +1,31 @@
|
||||
@sshd
|
||||
Feature: `mkdir' task action
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :mkdir_action do
|
||||
mkdir 'some_directory'
|
||||
mkdir 'some_directory_0700', mode: 0700
|
||||
mkdir 'some_directory_0711', mode: 0711
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: creates directory given as argument
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote directory "some_directory" must exists
|
||||
|
||||
Scenario: creates directory with given attributes
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote directory "some_directory_0700" must have 0700 mode
|
||||
And the remote directory "some_directory_0711" must have 0711 mode
|
||||
|
||||
Scenario: creates directories recursively
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :mkdir_action do
|
||||
mkdir 'some/directory'
|
||||
end
|
||||
"""
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote directory "some/directory" must exists
|
43
features/actions/sh.feature
Normal file
43
features/actions/sh.feature
Normal file
@@ -0,0 +1,43 @@
|
||||
@sshd
|
||||
Feature: `sh' task action
|
||||
|
||||
Scenario: forwards standard ouput
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :sh_action do
|
||||
sh '\echo hello from remote'
|
||||
end
|
||||
"""
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the output must contain exactly "hello from remote\n"
|
||||
|
||||
Scenario: forwards error ouput
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :sh_action do
|
||||
sh '\echo error from remote >&2'
|
||||
end
|
||||
"""
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the error output must contain exactly "error from remote\n"
|
||||
|
||||
Scenario: aborts on failed command execution
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :sh_action_aborting do
|
||||
sh '\false'
|
||||
sh '\echo after_fail'
|
||||
end
|
||||
"""
|
||||
When I execute the recipe on remote target
|
||||
Then the output must not contain "after_fail"
|
||||
|
||||
Scenario: prints command when execution fail
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :sh_action_command_error do
|
||||
sh '\false'
|
||||
end
|
||||
"""
|
||||
When I execute the recipe on remote target
|
||||
Then the output must match /\A\w+Error:\s+\\false/
|
14
features/actions/yaml_write.feature
Normal file
14
features/actions/yaml_write.feature
Normal file
@@ -0,0 +1,14 @@
|
||||
@sshd
|
||||
Feature: `yaml_write' task action
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :yaml_write_action do
|
||||
yaml_write 'some_file', data: { foo: 'bar' }
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: writes given data as YAML
|
||||
When I successfully execute the recipe on remote target
|
||||
Then the remote file "some_file" must match /^:foo: bar$/
|
Reference in New Issue
Block a user