From b995ef2680937a27fb6097725e4da52067220b63 Mon Sep 17 00:00:00 2001 From: Thibault Jouan Date: Wed, 23 Apr 2014 20:19:39 +0000 Subject: [PATCH] Rename all `has_*' test keywords --- features/tests/{has_dir.feature => dir.feature} | 4 ++-- features/tests/{has_env.feature => env.feature} | 6 +++--- .../tests/{has_executable.feature => executable.feature} | 6 +++--- features/tests/{has_file.feature => file.feature} | 4 ++-- features/tests/negated_test.feature | 8 ++++---- lib/producer/core/condition/dsl.rb | 8 ++++---- spec/producer/core/condition/dsl_spec.rb | 8 ++++---- 7 files changed, 22 insertions(+), 22 deletions(-) rename features/tests/{has_dir.feature => dir.feature} (85%) rename features/tests/{has_env.feature => env.feature} (83%) rename features/tests/{has_executable.feature => executable.feature} (79%) rename features/tests/{has_file.feature => file.feature} (85%) diff --git a/features/tests/has_dir.feature b/features/tests/dir.feature similarity index 85% rename from features/tests/has_dir.feature rename to features/tests/dir.feature index ec1b3bf..d16c6c4 100644 --- a/features/tests/has_dir.feature +++ b/features/tests/dir.feature @@ -1,5 +1,5 @@ @sshd -Feature: `has_dir' condition keyword +Feature: `dir?' condition keyword Background: Given a recipe with: @@ -7,7 +7,7 @@ Feature: `has_dir' condition keyword target 'some_host.test' task :testing_directory_existence do - condition { has_dir 'some_directory' } + condition { dir? 'some_directory' } echo 'evaluated' end diff --git a/features/tests/has_env.feature b/features/tests/env.feature similarity index 83% rename from features/tests/has_env.feature rename to features/tests/env.feature index ed30b98..ffab167 100644 --- a/features/tests/has_env.feature +++ b/features/tests/env.feature @@ -1,5 +1,5 @@ @sshd -Feature: `has_env' condition keyword +Feature: `env?' condition keyword Scenario: succeeds when remote environment variable is defined Given a recipe with: @@ -7,7 +7,7 @@ Feature: `has_env' condition keyword target 'some_host.test' task :testing_env_var_definition do - condition { has_env :shell } + condition { env? :shell } echo 'evaluated' end @@ -21,7 +21,7 @@ Feature: `has_env' condition keyword target 'some_host.test' task :testing_env_var_definition do - condition { has_env :inexistent_var } + condition { env? :inexistent_var } echo 'evaluated' end diff --git a/features/tests/has_executable.feature b/features/tests/executable.feature similarity index 79% rename from features/tests/has_executable.feature rename to features/tests/executable.feature index 0ff2052..a32c6f2 100644 --- a/features/tests/has_executable.feature +++ b/features/tests/executable.feature @@ -1,5 +1,5 @@ @sshd -Feature: `has_executable' condition keyword +Feature: `executable?' condition keyword Scenario: succeeds when remote executable is available Given a recipe with: @@ -7,7 +7,7 @@ Feature: `has_executable' condition keyword target 'some_host.test' task :testing_executable_availability do - condition { has_executable 'true' } + condition { executable? 'true' } echo 'evaluated' end @@ -21,7 +21,7 @@ Feature: `has_executable' condition keyword target 'some_host.test' task :testing_executable_availability do - condition { has_executable 'some_non_existent_executable' } + condition { executable? 'some_non_existent_executable' } echo 'evaluated' end diff --git a/features/tests/has_file.feature b/features/tests/file.feature similarity index 85% rename from features/tests/has_file.feature rename to features/tests/file.feature index a3a60fb..9614be8 100644 --- a/features/tests/has_file.feature +++ b/features/tests/file.feature @@ -1,5 +1,5 @@ @sshd -Feature: `has_file' condition keyword +Feature: `file?' condition keyword Background: Given a recipe with: @@ -7,7 +7,7 @@ Feature: `has_file' condition keyword target 'some_host.test' task :testing_file_existence do - condition { has_file 'some_file' } + condition { file? 'some_file' } echo 'evaluated' end diff --git a/features/tests/negated_test.feature b/features/tests/negated_test.feature index e494f4b..bd30493 100644 --- a/features/tests/negated_test.feature +++ b/features/tests/negated_test.feature @@ -7,13 +7,13 @@ Feature: negated test prefix (no_) target 'some_host.test' task :successful_test do - condition { has_env :shell } + condition { env? :shell } echo 'successful_test' end task :negated_test do - condition { no_has_env :shell } + condition { no_env? :shell } echo 'negated_test' end @@ -28,13 +28,13 @@ Feature: negated test prefix (no_) target 'some_host.test' task :failing_test do - condition { has_env :inexistent_var } + condition { env? :inexistent_var } echo 'failing_test' end task :negated_test do - condition { no_has_env :inexistent_var } + condition { no_env? :inexistent_var } echo 'negated_test' end diff --git a/lib/producer/core/condition/dsl.rb b/lib/producer/core/condition/dsl.rb index 48a8ec9..4bc0721 100644 --- a/lib/producer/core/condition/dsl.rb +++ b/lib/producer/core/condition/dsl.rb @@ -16,10 +16,10 @@ module Producer 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 - define_test :has_dir, Tests::HasDir - define_test :has_file, Tests::HasFile + define_test :env?, Tests::HasEnv + define_test :executable?, Tests::HasExecutable + define_test :dir?, Tests::HasDir + define_test :file?, Tests::HasFile attr_reader :block, :env, :tests diff --git a/spec/producer/core/condition/dsl_spec.rb b/spec/producer/core/condition/dsl_spec.rb index 0f5ff2a..14ef1d3 100644 --- a/spec/producer/core/condition/dsl_spec.rb +++ b/spec/producer/core/condition/dsl_spec.rb @@ -11,10 +11,10 @@ module Producer::Core ` sh file_contains - has_dir - has_env - has_executable - has_file + dir? + env? + executable? + file? ].each do |test| it "has `#{test}' test defined" do expect(dsl).to respond_to test.to_sym