Rename all `has_*' test keywords

This commit is contained in:
Thibault Jouan 2014-04-23 20:19:39 +00:00
parent 66e3dfd186
commit b995ef2680
7 changed files with 22 additions and 22 deletions

View File

@ -1,5 +1,5 @@
@sshd @sshd
Feature: `has_dir' condition keyword Feature: `dir?' condition keyword
Background: Background:
Given a recipe with: Given a recipe with:
@ -7,7 +7,7 @@ Feature: `has_dir' condition keyword
target 'some_host.test' target 'some_host.test'
task :testing_directory_existence do task :testing_directory_existence do
condition { has_dir 'some_directory' } condition { dir? 'some_directory' }
echo 'evaluated' echo 'evaluated'
end end

View File

@ -1,5 +1,5 @@
@sshd @sshd
Feature: `has_env' condition keyword Feature: `env?' condition keyword
Scenario: succeeds when remote environment variable is defined Scenario: succeeds when remote environment variable is defined
Given a recipe with: Given a recipe with:
@ -7,7 +7,7 @@ Feature: `has_env' condition keyword
target 'some_host.test' target 'some_host.test'
task :testing_env_var_definition do task :testing_env_var_definition do
condition { has_env :shell } condition { env? :shell }
echo 'evaluated' echo 'evaluated'
end end
@ -21,7 +21,7 @@ Feature: `has_env' condition keyword
target 'some_host.test' target 'some_host.test'
task :testing_env_var_definition do task :testing_env_var_definition do
condition { has_env :inexistent_var } condition { env? :inexistent_var }
echo 'evaluated' echo 'evaluated'
end end

View File

@ -1,5 +1,5 @@
@sshd @sshd
Feature: `has_executable' condition keyword Feature: `executable?' condition keyword
Scenario: succeeds when remote executable is available Scenario: succeeds when remote executable is available
Given a recipe with: Given a recipe with:
@ -7,7 +7,7 @@ Feature: `has_executable' condition keyword
target 'some_host.test' target 'some_host.test'
task :testing_executable_availability do task :testing_executable_availability do
condition { has_executable 'true' } condition { executable? 'true' }
echo 'evaluated' echo 'evaluated'
end end
@ -21,7 +21,7 @@ Feature: `has_executable' condition keyword
target 'some_host.test' target 'some_host.test'
task :testing_executable_availability do task :testing_executable_availability do
condition { has_executable 'some_non_existent_executable' } condition { executable? 'some_non_existent_executable' }
echo 'evaluated' echo 'evaluated'
end end

View File

@ -1,5 +1,5 @@
@sshd @sshd
Feature: `has_file' condition keyword Feature: `file?' condition keyword
Background: Background:
Given a recipe with: Given a recipe with:
@ -7,7 +7,7 @@ Feature: `has_file' condition keyword
target 'some_host.test' target 'some_host.test'
task :testing_file_existence do task :testing_file_existence do
condition { has_file 'some_file' } condition { file? 'some_file' }
echo 'evaluated' echo 'evaluated'
end end

View File

@ -7,13 +7,13 @@ Feature: negated test prefix (no_)
target 'some_host.test' target 'some_host.test'
task :successful_test do task :successful_test do
condition { has_env :shell } condition { env? :shell }
echo 'successful_test' echo 'successful_test'
end end
task :negated_test do task :negated_test do
condition { no_has_env :shell } condition { no_env? :shell }
echo 'negated_test' echo 'negated_test'
end end
@ -28,13 +28,13 @@ Feature: negated test prefix (no_)
target 'some_host.test' target 'some_host.test'
task :failing_test do task :failing_test do
condition { has_env :inexistent_var } condition { env? :inexistent_var }
echo 'failing_test' echo 'failing_test'
end end
task :negated_test do task :negated_test do
condition { no_has_env :inexistent_var } condition { no_env? :inexistent_var }
echo 'negated_test' echo 'negated_test'
end end

View File

@ -16,10 +16,10 @@ module Producer
define_test :`, Tests::ShellCommandStatus define_test :`, Tests::ShellCommandStatus
define_test :sh, Tests::ShellCommandStatus define_test :sh, Tests::ShellCommandStatus
define_test :file_contains, Tests::FileContains define_test :file_contains, Tests::FileContains
define_test :has_env, Tests::HasEnv define_test :env?, Tests::HasEnv
define_test :has_executable, Tests::HasExecutable define_test :executable?, Tests::HasExecutable
define_test :has_dir, Tests::HasDir define_test :dir?, Tests::HasDir
define_test :has_file, Tests::HasFile define_test :file?, Tests::HasFile
attr_reader :block, :env, :tests attr_reader :block, :env, :tests

View File

@ -11,10 +11,10 @@ module Producer::Core
` `
sh sh
file_contains file_contains
has_dir dir?
has_env env?
has_executable executable?
has_file file?
].each do |test| ].each do |test|
it "has `#{test}' test defined" do it "has `#{test}' test defined" do
expect(dsl).to respond_to test.to_sym expect(dsl).to respond_to test.to_sym