summaryrefslogtreecommitdiff
path: root/spec/unit/node
diff options
context:
space:
mode:
authordanielsdeleo <dan@opscode.com>2013-01-28 09:02:06 -0800
committerdanielsdeleo <dan@opscode.com>2013-01-28 10:56:08 -0800
commitea0205d629d5eb0aa25823d2cfc33d737adfe171 (patch)
tree5fec33074514b8bbda8c22729b1799fe9140f7d8 /spec/unit/node
parentc9afae1142cc7f55bee00e4841c4335a870fde5a (diff)
downloadchef-ea0205d629d5eb0aa25823d2cfc33d737adfe171.tar.gz
[CHEF-3799] fixes TypeError for puts on VividMash
Diffstat (limited to 'spec/unit/node')
-rw-r--r--spec/unit/node/attribute_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/unit/node/attribute_spec.rb b/spec/unit/node/attribute_spec.rb
index fac898be26..435dc3230c 100644
--- a/spec/unit/node/attribute_spec.rb
+++ b/spec/unit/node/attribute_spec.rb
@@ -234,6 +234,19 @@ describe Chef::Node::Attribute do
end
end
+ describe "when printing attribute components" do
+
+ it "does not cause a type error" do
+ # See CHEF-3799; IO#puts implicitly calls #to_ary on its argument. This
+ # is expected to raise a NoMethodError or return an Array. `to_ary` is
+ # the "strict" conversion method that should only be implemented by
+ # things that are truly Array-like, so NoMethodError is the right choice.
+ # (cf. there is no Hash#to_ary).
+ lambda { @attributes.default.to_ary }.should raise_error(NoMethodError)
+ end
+
+ end
+
describe "when fetching values based on precedence" do
before do
@attributes.default["default"] = "cookbook default"