diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2015-01-08 06:52:29 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-01-08 06:52:29 -0800 |
commit | 55f61bbd825709147c6db18740092a0f95645823 (patch) | |
tree | 09cbdd6e30d1c4a89adffddf4fe9dd4f36f5a08c | |
parent | 9c2a2a0e60a6e95accad1034a44fe6663b56a18e (diff) | |
download | chef-55f61bbd825709147c6db18740092a0f95645823.tar.gz |
add tests (broken)
-rw-r--r-- | lib/chef/resource.rb | 4 | ||||
-rw-r--r-- | spec/unit/recipe_spec.rb | 22 |
2 files changed, 26 insertions, 0 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index d9107eeb9a..2ccae1cef9 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -299,11 +299,15 @@ F def identical_resource?(prior_resource) skipped_ivars = [ :@source_line, :@cookbook_name, :@recipe_name, :@params, :@elapsed_time ] checked_ivars = prior_resource.instance_variables - skipped_ivars + pp prior_resource.instance_variables non_matching_ivars = checked_ivars.reject do |iv| if iv == :@action && ( [self.instance_variable_get(iv)].flatten == [:nothing] || [prior_resource.instance_variable_get(iv)].flatten == [:nothing] ) # :nothing action on either side of the comparison always matches true else + puts iv + puts self.instance_variable_get(iv) + puts prior_resource.instance_variable_get(iv) self.instance_variable_get(iv) == prior_resource.instance_variable_get(iv) end end diff --git a/spec/unit/recipe_spec.rb b/spec/unit/recipe_spec.rb index fef527c485..e27e6c708d 100644 --- a/spec/unit/recipe_spec.rb +++ b/spec/unit/recipe_spec.rb @@ -173,6 +173,28 @@ describe Chef::Recipe do end end + it "should emit a 3694 warning when attributes change" do + recipe.zen_master "klopp" do + something "bvb" + end + expect(Chef::Log).to receive(:warn).at_least(:once) + recipe.zen_master "klopp" do + something "bvb" + peace true + end + end + + it "should emit a 3694 warning when attributes change" do + recipe.zen_master "klopp" do + something "bvb" + peace true + end + expect(Chef::Log).to receive(:warn).at_least(:once) + recipe.zen_master "klopp" do + something "bvb" + end + end + it "should not emit a 3694 warning when attributes do not change" do recipe.zen_master "klopp" do something "bvb" |