From 54799d8d25ed4565177f2a752088a220220c7344 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Mon, 14 Dec 2015 16:46:12 -0800 Subject: really always return an Array --- spec/unit/node_spec.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'spec/unit') diff --git a/spec/unit/node_spec.rb b/spec/unit/node_spec.rb index 40e8cf8898..76cf451323 100644 --- a/spec/unit/node_spec.rb +++ b/spec/unit/node_spec.rb @@ -810,6 +810,18 @@ describe Chef::Node do expect(node.tags).to eql([]) end + it "should return an array if it is fed a string" do + node.normal[:tags] = "string" + node.consume_external_attrs(@ohai_data, {}) + expect(node.tags).to eql(["string"]) + end + + it "should return an array if it is fed a hash" do + node.normal[:tags] = {} + node.consume_external_attrs(@ohai_data, {}) + expect(node.tags).to eql([]) + end + it "deep merges attributes instead of overwriting them" do node.consume_external_attrs(@ohai_data, "one" => {"two" => {"three" => "four"}}) expect(node.one.to_hash).to eq({"two" => {"three" => "four"}}) -- cgit v1.2.1