Unflatten features directory tree
This commit is contained in:
23
features/task/ask.feature
Normal file
23
features/task/ask.feature
Normal file
@@ -0,0 +1,23 @@
|
||||
Feature: `ask' task keyword
|
||||
|
||||
@exec
|
||||
Scenario: prompts user with a list of choices on standard output
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :ask_letter do
|
||||
letter = ask 'Which letter?', [[:a, ?A], [:b, ?B]]
|
||||
|
||||
echo letter.inspect
|
||||
end
|
||||
"""
|
||||
When I execute the recipe interactively
|
||||
And I type "1"
|
||||
Then the output must contain:
|
||||
"""
|
||||
Which letter?
|
||||
0: A
|
||||
1: B
|
||||
Choice:
|
||||
:b
|
||||
"""
|
||||
And the exit status must be 0
|
13
features/task/condition.feature
Normal file
13
features/task/condition.feature
Normal file
@@ -0,0 +1,13 @@
|
||||
Feature: `condition' task keyword
|
||||
|
||||
Scenario: prevents task actions application when condition is not met
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :some_task do
|
||||
condition { false }
|
||||
|
||||
echo 'evaluated'
|
||||
end
|
||||
"""
|
||||
When I successfully execute the recipe
|
||||
Then the output must not contain "evaluated"
|
20
features/task/nested_tasks.feature
Normal file
20
features/task/nested_tasks.feature
Normal file
@@ -0,0 +1,20 @@
|
||||
Feature: nested tasks
|
||||
|
||||
Background:
|
||||
Given a recipe with:
|
||||
"""
|
||||
task :outer_task do
|
||||
task :inner_task do
|
||||
echo 'OK'
|
||||
end
|
||||
end
|
||||
"""
|
||||
|
||||
Scenario: applies nested tasks
|
||||
When I successfully execute the recipe
|
||||
Then the output must match /\AOK/
|
||||
|
||||
Scenario: indents logging from nested tasks
|
||||
When I successfully execute the recipe with option -v
|
||||
Then the output must match /^ Task:.+/
|
||||
And the output must match /^ action:.+/
|
11
features/task/target.feature
Normal file
11
features/task/target.feature
Normal file
@@ -0,0 +1,11 @@
|
||||
Feature: `target' task keyword
|
||||
|
||||
Scenario: returns the current target
|
||||
Given a recipe with:
|
||||
"""
|
||||
target 'some_host.example'
|
||||
|
||||
task(:echo_target) { echo target }
|
||||
"""
|
||||
When I execute the recipe
|
||||
Then the output must contain "some_host.example"
|
49
features/task/template.feature
Normal file
49
features/task/template.feature
Normal file
@@ -0,0 +1,49 @@
|
||||
Feature: `template' task keyword
|
||||
|
||||
Scenario: renders an ERB template file
|
||||
Given a file named "templates/basic.erb" with:
|
||||
"""
|
||||
basic template
|
||||
"""
|
||||
And a recipe with:
|
||||
"""
|
||||
task(:echo_template) { echo template 'basic' }
|
||||
"""
|
||||
When I execute the recipe
|
||||
Then the output must contain "basic template"
|
||||
|
||||
Scenario: renders ERB with given attributes as member data
|
||||
Given a file named "templates/variables.erb" with:
|
||||
"""
|
||||
<%= @foo %>
|
||||
"""
|
||||
And a recipe with:
|
||||
"""
|
||||
task(:echo_template) { echo template('variables', foo: 'bar') }
|
||||
"""
|
||||
When I execute the recipe
|
||||
Then the output must contain "bar"
|
||||
|
||||
Scenario: renders without `templates' search path
|
||||
Given a file named "templates/basic.erb" with:
|
||||
"""
|
||||
basic template
|
||||
"""
|
||||
And a recipe with:
|
||||
"""
|
||||
task(:echo_template) { echo template './templates/basic' }
|
||||
"""
|
||||
When I execute the recipe
|
||||
Then the output must contain "basic template"
|
||||
|
||||
Scenario: parses a yaml file
|
||||
Given a file named "templates/basic.yaml" with:
|
||||
"""
|
||||
foo: bar
|
||||
"""
|
||||
And a recipe with:
|
||||
"""
|
||||
task(:echo_template) { echo template('basic')['foo'] }
|
||||
"""
|
||||
When I execute the recipe
|
||||
Then the output must match /^bar$/
|
Reference in New Issue
Block a user