Unflatten features directory tree

This commit is contained in:
Thibault Jouan
2014-11-18 11:58:23 +00:00
parent 86a84bbe12
commit 2d3975d47f
36 changed files with 1 additions and 0 deletions

View 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/

View 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"

View 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"

View 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

View 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

View 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/

View 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$/