diff options
author | Xabier de Zuazo <xabier@zuazo.org> | 2013-01-23 22:32:08 +0100 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-06-19 14:18:43 -0700 |
commit | 4c29883b38c6179a8b3fead064d7095159ba5cca (patch) | |
tree | b10193aeb0681b39c6d9237ea2eb7bffc8ebf766 | |
parent | 62b156aec03ecb1d6ece0a3dc8a277f5332d0990 (diff) | |
download | chef-4c29883b38c6179a8b3fead064d7095159ba5cca.tar.gz |
[CHEF-972] removed the #self.not_if method and the private constructor from ConditionalActionNothing and renamed to ConditionalActionNotNothing
-rw-r--r-- | lib/chef/resource.rb | 4 | ||||
-rw-r--r-- | lib/chef/resource/conditional_action_not_nothing.rb (renamed from lib/chef/resource/conditional_action_nothing.rb) | 12 | ||||
-rw-r--r-- | spec/unit/resource/conditional_action_not_nothing_spec.rb (renamed from spec/unit/resource/conditional_action_nothing_spec.rb) | 34 |
3 files changed, 19 insertions, 31 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 727a0b7962..997c614171 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -23,7 +23,7 @@ require 'chef/dsl/data_query' require 'chef/dsl/registry_helper' require 'chef/mixin/convert_to_class_name' require 'chef/resource/conditional' -require 'chef/resource/conditional_action_nothing' +require 'chef/resource/conditional_action_not_nothing' require 'chef/resource_collection' require 'chef/resource_platform_map' require 'chef/node' @@ -676,7 +676,7 @@ F # # Also skips conditional checking when the action is :nothing def should_skip?(action) - conditional_action = ConditionalActionNothing.not_if(action) + conditional_action = ConditionalActionNotNothing.new(action) conditionals = [ conditional_action ] + only_if + not_if conditionals.find do |conditional| diff --git a/lib/chef/resource/conditional_action_nothing.rb b/lib/chef/resource/conditional_action_not_nothing.rb index f1e9837e81..f6c34b20b5 100644 --- a/lib/chef/resource/conditional_action_nothing.rb +++ b/lib/chef/resource/conditional_action_not_nothing.rb @@ -18,17 +18,7 @@ class Chef class Resource - class ConditionalActionNothing - - # We only create these via the `not_if` constructor, - # not the default constructor - class << self - private :new - end - - def self.not_if(current_action) - new(current_action) - end + class ConditionalActionNotNothing attr_reader :current_action diff --git a/spec/unit/resource/conditional_action_nothing_spec.rb b/spec/unit/resource/conditional_action_not_nothing_spec.rb index 9e3e5d917e..49bc0ad57d 100644 --- a/spec/unit/resource/conditional_action_nothing_spec.rb +++ b/spec/unit/resource/conditional_action_not_nothing_spec.rb @@ -18,29 +18,27 @@ require 'spec_helper' -describe Chef::Resource::ConditionalActionNothing do +describe Chef::Resource::ConditionalActionNotNothing do - describe "when created as a `not_if`" do - describe "after running the correct action" do - before do - @action = :nothing - @conditional = Chef::Resource::ConditionalActionNothing.not_if(@action) - end + describe "after running a :nothing action" do + before do + @action = :nothing + @conditional = Chef::Resource::ConditionalActionNotNothing.new(@action) + end - it "indicates that resource convergence should not continue" do - @conditional.continue?.should be_false - end + it "indicates that resource convergence should not continue" do + @conditional.continue?.should be_false end + end - describe "after running an incorrect action" do - before do - @action = :something - @conditional = Chef::Resource::ConditionalActionNothing.not_if(@action) - end + describe "after running an action different to :nothing" do + before do + @action = :something + @conditional = Chef::Resource::ConditionalActionNotNothing.new(@action) + end - it "indicates that resource convergence should continue" do - @conditional.continue?.should be_true - end + it "indicates that resource convergence should continue" do + @conditional.continue?.should be_true end end |