diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2017-03-16 16:10:18 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-16 16:10:18 -0700 |
commit | f76bbb6f5f6a67199df9d302ef20b647e208ab1e (patch) | |
tree | 338f8786067c505812747bc0ee9e2ff5962c16d4 /spec | |
parent | f3e87f59f66072cb86bce67d80ac2047041bd7be (diff) | |
parent | 619a3d40eb6e0aa1627f5cafbc25245a7eef447f (diff) | |
download | chef-f76bbb6f5f6a67199df9d302ef20b647e208ab1e.tar.gz |
Merge pull request #5911 from chef/lcg/debub-value-arrays
fix node#debug_value access through arrays
Diffstat (limited to 'spec')
-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 |