diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-16 14:40:40 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-16 14:40:40 -0700 |
commit | 619a3d40eb6e0aa1627f5cafbc25245a7eef447f (patch) | |
tree | 0b121794fbb6c16e0c908f945a6649abc2671d8d /spec/unit/node/attribute_spec.rb | |
parent | 1f23881a95d1dfa63158c7c35d3f8723df97a758 (diff) | |
download | chef-619a3d40eb6e0aa1627f5cafbc25245a7eef447f.tar.gz |
fix node#debug_value access through arrayslcg/debub-value-arrays
nod to @jaymzh for finding this one.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
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 |