diff options
-rw-r--r-- | lib/chef/resource.rb | 2 | ||||
-rw-r--r-- | spec/unit/property_spec.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource.rb b/lib/chef/resource.rb index 8b248877e3..5bef40625f 100644 --- a/lib/chef/resource.rb +++ b/lib/chef/resource.rb @@ -809,7 +809,7 @@ class Chef end if !options[:default].frozen? && (options[:default].is_a?(Array) || options[:default].is_a?(Hash)) - Chef::Log.debug("Property #{self}.#{name} has an array or hash default (#{options[:default]}). This means that if one resource modifies or appends to it, all other resources of the same type will also see the changes. Either freeze the constant with `.freeze` to prevent appending, or use lazy { #{options[:default].inspect} }.") + Chef::Log.warn("Property #{self}.#{name} has an array or hash default (#{options[:default]}). This means that if one resource modifies or appends to it, all other resources of the same type will also see the changes. Either freeze the constant with `.freeze` to prevent appending, or use lazy { #{options[:default].inspect} }.") end local_properties = properties(false) diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb index b2e9e2acde..55eaead9ba 100644 --- a/spec/unit/property_spec.rb +++ b/spec/unit/property_spec.rb @@ -476,8 +476,8 @@ describe "Chef::Resource.property" do end end - it "when a property is declared with default: {}, a debug level warning is issued" do - expect(Chef::Log).to receive(:debug).with(match(/^Property .+\.x has an array or hash default \(\{\}\)\. This means that if one resource modifies or appends to it, all other resources of the same type will also see the changes\. Either freeze the constant with \`\.freeze\` to prevent appending, or use lazy \{ \{\} \}\.$/)) + it "when a property is declared with default: {}, a warning is issued" do + expect(Chef::Log).to receive(:warn).with(match(/^Property .+\.x has an array or hash default \(\{\}\)\. This means that if one resource modifies or appends to it, all other resources of the same type will also see the changes\. Either freeze the constant with \`\.freeze\` to prevent appending, or use lazy \{ \{\} \}\.$/)) resource_class.class_eval("property :x, default: {}", __FILE__, __LINE__) expect(resource.x).to eq({}) end |