summaryrefslogtreecommitdiff
path: root/spec/unit/node
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2012-11-08 11:31:17 -0800
committerdanielsdeleo <dan@opscode.com>2012-11-09 11:00:59 -0800
commit5f19be6a6bb96ae54507a64ca4742d50ab68d63f (patch)
treeeb54d92e8b7a31439171a546310d60a0434c21ab /spec/unit/node
parent238c2125181934e0f2b1db64c445a7f44af7ba8b (diff)
downloadchef-5f19be6a6bb96ae54507a64ca4742d50ab68d63f.tar.gz
Add "force" level precedence to Node::Attribute
Diffstat (limited to 'spec/unit/node')
-rw-r--r--spec/unit/node/attribute_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index d20b52b779..4cc64cab3b 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -240,6 +240,13 @@ describe Chef::Node::Attribute do
@attributes.override["override"] = "cookbook override"
end
+ it "prefers 'forced default' over any other default" do
+ @attributes.default!["default"] = "force default"
+ @attributes.role_default["default"] = "role default"
+ @attributes.env_default["default"] = "environment default"
+ @attributes["default"].should == "force default"
+ end
+
it "prefers role_default over environment or cookbook default" do
@attributes.role_default["default"] = "role default"
@attributes.env_default["default"] = "environment default"
@@ -255,6 +262,13 @@ describe Chef::Node::Attribute do
@attributes["default"].should == "cookbook default"
end
+ it "prefers 'forced overrides' over role or cookbook overrides" do
+ @attributes.override!["override"] = "force override"
+ @attributes.env_override["override"] = "environment override"
+ @attributes.role_override["override"] = "role override"
+ @attributes["override"].should == "force override"
+ end
+
it "prefers environment overrides over role or cookbook overrides" do
@attributes.env_override["override"] = "environment override"
@attributes.role_override["override"] = "role override"
@@ -277,21 +291,25 @@ describe Chef::Node::Attribute do
@attributes.default["cd"] = "cookbook default"
@attributes.role_default["rd"] = "role default"
@attributes.env_default["ed"] = "env default"
+ @attributes.default!["fd"] = "force default"
@attributes.override["co"] = "cookbook override"
@attributes.role_override["ro"] = "role override"
@attributes.env_override["eo"] = "env override"
+ @attributes.override!["fo"] = "force override"
end
it "merges all types of overrides into a combined override" do
@attributes.combined_override["co"].should == "cookbook override"
@attributes.combined_override["ro"].should == "role override"
@attributes.combined_override["eo"].should == "env override"
+ @attributes.combined_override["fo"].should == "force override"
end
it "merges all types of defaults into a combined default" do
@attributes.combined_default["cd"].should == "cookbook default"
@attributes.combined_default["rd"].should == "role default"
@attributes.combined_default["ed"].should == "env default"
+ @attributes.combined_default["fd"].should == "force default"
end
end