From 0af05294137e652979db5effa0cb50d512a2d3a9 Mon Sep 17 00:00:00 2001 From: tyler-ball Date: Wed, 11 Feb 2015 18:20:44 -0800 Subject: Completing tests for https://github.com/chef/chef/pull/2310, fixes https://github.com/chef/chef/issues/1562 --- spec/unit/node/attribute_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'spec') 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={...} -- cgit v1.2.1