summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorTyler Ball <tyleraball@gmail.com>2015-02-13 09:51:32 -0800
committerTyler Ball <tyleraball@gmail.com>2015-02-13 09:51:32 -0800
commitda1adbb2979b7096594968ad0fbbadc8c5f480d3 (patch)
tree00a0b77884a026396bc7557ab4da6f89544ebae8 /spec
parent139503e42d8db84ed8f620a44fe8810e0d1742ff (diff)
parent0af05294137e652979db5effa0cb50d512a2d3a9 (diff)
downloadchef-da1adbb2979b7096594968ad0fbbadc8c5f480d3.tar.gz
Merge pull request #2900 from chef/tball/complete-2310
Completing tests for https://github.com/chef/chef/pull/2310
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/node/attribute_spec.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index c924ee2811..250b8c630c 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -1108,6 +1108,26 @@ describe Chef::Node::Attribute do
end
end
+ describe "to_s" do
+ it "should output simple attributes" do
+ attributes = Chef::Node::Attribute.new(nil, nil, nil, nil)
+ expect(attributes.to_s).to eq("{}")
+ end
+
+ it "should output merged attributes" do
+ default_hash = {
+ "a" => 1,
+ "b" => 2
+ }
+ override_hash = {
+ "b" => 3,
+ "c" => 4
+ }
+ attributes = Chef::Node::Attribute.new(nil, default_hash, override_hash, nil)
+ expect(attributes.to_s).to eq('{"a"=>1, "b"=>3, "c"=>4}')
+ end
+ end
+
describe "inspect" do
it "should be readable" do
# NOTE: previous implementation hid the values, showing @automatic={...}