diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-10-07 15:12:00 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-10-25 09:29:29 -0700 |
commit | cbbc1c722a662596189a1a0b9aeee584b3482873 (patch) | |
tree | 2871e73e1c31a6cd1751805a1500ea80809d2c86 | |
parent | 6536f15dcb53938fe9c77e7438b20fe6ac3cdffb (diff) | |
download | chef-cbbc1c722a662596189a1a0b9aeee584b3482873.tar.gz |
add tests from #4207
validates that we fixed the top_level_breadcrumb-state related bug
which has been reported
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | spec/unit/node_spec.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 3b9501d73c..70461e238b 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -1793,4 +1793,23 @@ describe Chef::Node do expect(node.default["foo"][0]["bar"].__root).to eql(node.attributes) end end + + describe "ways of abusing Chef 12 node state" do + # these tests abuse the top_level_breadcrumb state in Chef 12 + it "derived attributes work correctly" do + node.default["v1"] = 1 + expect(node["a"]).to eql(nil) + node.default["a"] = node["v1"] + expect(node["a"]).to eql(1) + end + + it "works when saving nodes to variables" do + a = node.default["a"] + expect(node["a"]).to eql({}) + node.default["b"] = 0 + a["key"] = 1 + + expect(node["a"]["key"]).to eql(1) + end + end end |