summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-01-11 14:09:59 -0800
committerLamont Granquist <lamont@scriptkiddie.org>2017-01-11 14:09:59 -0800
commit34797a6f6353d7111043e9a0e814d7b30090c5e1 (patch)
treed5a28a7b8d87d24d6603ce17ab21e34820252f3c /spec/unit
parent14d3f5aeb6b163cc2652db3c5724465cac9959e9 (diff)
downloadchef-34797a6f6353d7111043e9a0e814d7b30090c5e1.tar.gz
fix node attribute "unless" API methods
closes #5556 corrects behavior to 12.11.x behavior which was lost in the refactor may address #5715 Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/node_spec.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 59b4b8a1c7..ac227c5479 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -337,14 +337,35 @@ describe Chef::Node do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
expect(Chef).to receive(:deprecated).with(:attributes, /set is deprecated/)
node.set[:snoopy][:is_a_puppy] = true
- expect(node[:snoopy][:is_a_puppy]).to eq(true)
+ expect(node.normal[:snoopy][:is_a_puppy]).to eq(true)
end
it "set_unless is a deprecated alias for normal_unless" do
Chef::Config[:treat_deprecation_warnings_as_errors] = false
expect(Chef).to receive(:deprecated).with(:attributes, /set_unless is deprecated/)
node.set_unless[:snoopy][:is_a_puppy] = false
- expect(node[:snoopy][:is_a_puppy]).to eq(false)
+ expect(node.normal[:snoopy][:is_a_puppy]).to eq(false)
+ end
+
+ it "normal_unless sets a value even if default or override attrs are set" do
+ node.default[:decontamination] = true
+ node.override[:decontamination] = false
+ node.normal_unless[:decontamination] = "foo"
+ expect(node.normal[:decontamination]).to eql("foo")
+ end
+
+ it "default_unless sets a value even if normal or override attrs are set" do
+ node.normal[:decontamination] = true
+ node.override[:decontamination] = false
+ node.default_unless[:decontamination] = "foo"
+ expect(node.default[:decontamination]).to eql("foo")
+ end
+
+ it "override_unless sets a value even if default or normal attrs are set" do
+ node.default[:decontamination] = true
+ node.normal[:decontamination] = false
+ node.override_unless[:decontamination] = "foo"
+ expect(node.override[:decontamination]).to eql("foo")
end
end