diff --git a/features/tests/shell_command_status.feature b/features/tests/shell_command_status.feature index 5c03ab5..890e8d3 100644 --- a/features/tests/shell_command_status.feature +++ b/features/tests/shell_command_status.feature @@ -28,3 +28,31 @@ Feature: `` condition keyword """ When I successfully execute the recipe Then the output must not contain "evaluated" + + Scenario: `sh' alias, succeeds when remote executable is available + Given a recipe with: + """ + target 'some_host.test' + + task :testing_remote_command do + condition { sh 'false' } + + echo 'evaluated' + end + """ + When I successfully execute the recipe + Then the output must not contain "evaluated" + + Scenario: succeeds when remote executable is available + Given a recipe with: + """ + target 'some_host.test' + + task :testing_remote_command do + condition { sh 'false' } + + echo 'evaluated' + end + """ + When I successfully execute the recipe + Then the output must not contain "evaluated" diff --git a/lib/producer/core/condition/dsl.rb b/lib/producer/core/condition/dsl.rb index 6d4eaec..48a8ec9 100644 --- a/lib/producer/core/condition/dsl.rb +++ b/lib/producer/core/condition/dsl.rb @@ -14,6 +14,7 @@ module Producer end define_test :`, Tests::ShellCommandStatus + define_test :sh, Tests::ShellCommandStatus define_test :file_contains, Tests::FileContains define_test :has_env, Tests::HasEnv define_test :has_executable, Tests::HasExecutable diff --git a/spec/producer/core/condition/dsl_spec.rb b/spec/producer/core/condition/dsl_spec.rb index 065cee3..0f5ff2a 100644 --- a/spec/producer/core/condition/dsl_spec.rb +++ b/spec/producer/core/condition/dsl_spec.rb @@ -9,6 +9,7 @@ module Producer::Core %w[ ` + sh file_contains has_dir has_env