Improve cucumber feature for negated test prefix

This commit is contained in:
Thibault Jouan 2014-09-22 20:20:37 +00:00
parent 6b6107895e
commit 675871c3f5

View File

@ -1,40 +1,47 @@
@sshd
Feature: negated test prefix (no_) Feature: negated test prefix (no_)
Scenario: prefixed test fails when non-prefixed test is successful Scenario: prefixed test fails when non-prefixed test is successful
Given a recipe with: Given a recipe with:
""" """
test_macro :even? do |n|
n % 2 == 0
end
task :successful_test do task :successful_test do
condition { env? :shell } condition { even? 4 }
echo 'successful_test' echo 'successful_test'
end end
task :negated_test do task :negated_test do
condition { no_env? :shell } condition { no_even? 4 }
echo 'negated_test' echo 'negated_test'
end end
""" """
When I successfully execute the recipe on remote target When I successfully execute the recipe
Then the output must contain "successful_test" Then the output must contain "successful_test"
And the output must not contain "negated_test" And the output must not contain "negated_test"
Scenario: prefixed test fails when non-prefixed test is failing Scenario: prefixed test succeed when non-prefixed test is failing
Given a recipe with: Given a recipe with:
""" """
test_macro :even? do |n|
n % 2 == 0
end
task :failing_test do task :failing_test do
condition { env? :inexistent_var } condition { even? 5 }
echo 'failing_test' echo 'failing_test'
end end
task :negated_test do task :negated_test do
condition { no_env? :inexistent_var } condition { no_even? 5 }
echo 'negated_test' echo 'negated_test'
end end
""" """
When I successfully execute the recipe on remote target When I successfully execute the recipe
Then the output must not contain "failing_test" Then the output must not contain "failing_test"
And the output must contain "negated_test" And the output must contain "negated_test"