summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-10-07 16:47:43 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-10-25 09:29:29 -0700
commit9edd0113f2d046e051845cf1916fcf733d392791 (patch)
tree3d23e6552e610f3be6b860c487385e77c5b04cf4 /spec
parentcbbc1c722a662596189a1a0b9aeee584b3482873 (diff)
downloadchef-9edd0113f2d046e051845cf1916fcf733d392791.tar.gz
rename __path to __path__ and __node to __node__lcg/node-path-tracking
consistency with Unchain here: https://github.com/chef/chef/blob/master/lib/chef/decorator/unchain.rb#L23-L24 and with SimpleDelegator: https://ruby-doc.org/stdlib-2.1.0/libdoc/delegate/rdoc/SimpleDelegator.html#method-i-__getobj__ Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/node/vivid_mash_spec.rb2
-rw-r--r--spec/unit/node_spec.rb42
2 files changed, 22 insertions, 22 deletions
diff --git a/spec/unit/node/vivid_mash_spec.rb b/spec/unit/node/vivid_mash_spec.rb
index 0955b6b1c3..017e6206fc 100644
--- a/spec/unit/node/vivid_mash_spec.rb
+++ b/spec/unit/node/vivid_mash_spec.rb
@@ -36,7 +36,7 @@ describe Chef::Node::VividMash do
end
it "sets the root to the root object" do
- expect(vivid["one"]["two"].__root).to eql(vivid)
+ expect(vivid["one"]["two"].__root__).to eql(vivid)
end
it "does not send reset cache" do
diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb
index 70461e238b..cfc19db480 100644
--- a/spec/unit/node_spec.rb
+++ b/spec/unit/node_spec.rb
@@ -1709,53 +1709,53 @@ describe Chef::Node do
end
end
- describe "path tracking via __path" do
+ describe "path tracking via __path__" do
it "works through hash keys" do
node.default["foo"] = { "bar" => { "baz" => "qux" } }
- expect(node["foo"]["bar"].__path).to eql(%w{foo bar})
+ expect(node["foo"]["bar"].__path__).to eql(%w{foo bar})
end
it "works through the default level" do
node.default["foo"] = { "bar" => { "baz" => "qux" } }
- expect(node.default["foo"]["bar"].__path).to eql(%w{foo bar})
+ expect(node.default["foo"]["bar"].__path__).to eql(%w{foo bar})
end
it "works through arrays" do
node.default["foo"] = [ { "bar" => { "baz" => "qux" } } ]
- expect(node["foo"][0].__path).to eql(["foo", 0])
- expect(node["foo"][0]["bar"].__path).to eql(["foo", 0, "bar"])
+ expect(node["foo"][0].__path__).to eql(["foo", 0])
+ expect(node["foo"][0]["bar"].__path__).to eql(["foo", 0, "bar"])
end
it "works through arrays at the default level" do
node.default["foo"] = [ { "bar" => { "baz" => "qux" } } ]
- expect(node.default["foo"][0].__path).to eql(["foo", 0])
- expect(node.default["foo"][0]["bar"].__path).to eql(["foo", 0, "bar"])
+ expect(node.default["foo"][0].__path__).to eql(["foo", 0])
+ expect(node.default["foo"][0]["bar"].__path__).to eql(["foo", 0, "bar"])
end
- # if we set __path in the initializer we'd get this wrong, this is why we
+ # if we set __path__ in the initializer we'd get this wrong, this is why we
# update the path on every #[] or #[]= operator
it "works on access when the node has been rearranged" do
node.default["foo"] = { "bar" => { "baz" => "qux" } }
a = node.default["foo"]
node.default["fizz"] = a
- expect(node["fizz"]["bar"].__path).to eql(%w{fizz bar})
- expect(node["foo"]["bar"].__path).to eql(%w{foo bar})
+ expect(node["fizz"]["bar"].__path__).to eql(%w{fizz bar})
+ expect(node["foo"]["bar"].__path__).to eql(%w{foo bar})
end
- # We have a problem because the __path is stored on in each node, but the
+ # We have a problem because the __path__ is stored on in each node, but the
# node can be wired up at multiple locations in the tree via pointers. One
# solution would be to deep-dup the value in `#[]=(key, value)` and fix the
- # __path on all the dup'd nodes. The problem is that this would create an
+ # __path__ on all the dup'd nodes. The problem is that this would create an
# unusual situation where after assignment, you couldn't mutate the thing you
# hand a handle on. I'm not entirely positive this behavior is the correct
# thing to support, but it is more hash-like (although if we start with a hash
# then convert_value does its thing and we *do* get dup'd on assignment). This
# behavior likely makes any implementation of a deep merge cache built over the
- # top of __path tracking have edge conditions where it will fail.
+ # top of __path__ tracking have edge conditions where it will fail.
#
# Removing this support would be a breaking change. The test is included here
# because it seems most likely that someone would break this behavior while trying
- # to fix __path behavior.
+ # to fix __path__ behavior.
it "does not dup in the background when a node is assigned" do
# get a handle on a vividmash (can't be a hash or else we convert_value it)
node.default["foo"] = { "bar" => { "baz" => "qux" } }
@@ -1770,27 +1770,27 @@ describe Chef::Node do
end
end
- describe "root tracking via __root" do
+ describe "root tracking via __root__" do
it "works through hash keys" do
node.default["foo"] = { "bar" => { "baz" => "qux" } }
- expect(node["foo"]["bar"].__root).to eql(node.attributes)
+ expect(node["foo"]["bar"].__root__).to eql(node.attributes)
end
it "works through the default level" do
node.default["foo"] = { "bar" => { "baz" => "qux" } }
- expect(node.default["foo"]["bar"].__root).to eql(node.attributes)
+ expect(node.default["foo"]["bar"].__root__).to eql(node.attributes)
end
it "works through arrays" do
node.default["foo"] = [ { "bar" => { "baz" => "qux" } } ]
- expect(node["foo"][0].__root).to eql(node.attributes)
- expect(node["foo"][0]["bar"].__root).to eql(node.attributes)
+ expect(node["foo"][0].__root__).to eql(node.attributes)
+ expect(node["foo"][0]["bar"].__root__).to eql(node.attributes)
end
it "works through arrays at the default level" do
node.default["foo"] = [ { "bar" => { "baz" => "qux" } } ]
- expect(node.default["foo"][0].__root).to eql(node.attributes)
- expect(node.default["foo"][0]["bar"].__root).to eql(node.attributes)
+ expect(node.default["foo"][0].__root__).to eql(node.attributes)
+ expect(node.default["foo"][0]["bar"].__root__).to eql(node.attributes)
end
end