diff options
Diffstat (limited to 'spec/unit/node/attribute_spec.rb')
-rw-r--r-- | spec/unit/node/attribute_spec.rb | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb index 3dd0d0f650..cf8d4d4a4f 100644 --- a/spec/unit/node/attribute_spec.rb +++ b/spec/unit/node/attribute_spec.rb @@ -208,7 +208,7 @@ describe Chef::Node::Attribute do end describe "when debugging attributes" do - before do + it "gives the value at each level of precedence for a path spec" do @attributes.default[:foo][:bar] = "default" @attributes.env_default[:foo][:bar] = "env_default" @attributes.role_default[:foo][:bar] = "role_default" @@ -219,9 +219,7 @@ describe Chef::Node::Attribute do @attributes.env_override[:foo][:bar] = "env_override" @attributes.force_override[:foo][:bar] = "force_override" @attributes.automatic[:foo][:bar] = "automatic" - end - it "gives the value at each level of precedence for a path spec" do expected = [ %w{default default}, %w{env_default env_default}, @@ -236,6 +234,25 @@ describe Chef::Node::Attribute do ] expect(@attributes.debug_value(:foo, :bar)).to eq(expected) end + + it "works through arrays" do + @attributes.default["foo"] = [ { "bar" => "baz" } ] + + expect(@attributes.debug_value(:foo, 0)).to eq( + [ + ["default", { "bar" => "baz" }], + ["env_default", :not_present], + ["role_default", :not_present], + ["force_default", :not_present], + ["normal", :not_present], + ["override", :not_present], + ["role_override", :not_present], + ["env_override", :not_present], + ["force_override", :not_present], + ["automatic", :not_present], + ] + ) + end end describe "when fetching values based on precedence" do |