summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-09-02 18:01:09 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-09-14 15:56:00 -0700
commit72cb4af6451f67791469456899df5bd09db94d7b (patch)
tree1ccdbe25220634512e9eef58e43c50a9a4ff4907 /spec
parenta300e22d486df119b5588ca28d13f21e5cdb7353 (diff)
downloadchef-72cb4af6451f67791469456899df5bd09db94d7b.tar.gz
Remove the warning about hashes and arrays as default values
- This isn't a bug to declare an LWRP default hash or array, its a bug to use the hash or array in such a way as to mutate it. A lot of LWRP authors will get this triggered on their code when none of their users are actually triggering the bug. - It would be better handled by freezing default values in Chef 13. - We could also just not try to solve this problem in code and treat it fundamentally as a documentation/education problem.
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/property_spec.rb6
1 files changed, 0 insertions, 6 deletions
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index 50764aa7a2..f758b5f403 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -480,12 +480,6 @@ describe "Chef::Resource.property" do
end
end
- it "when a property is declared with default: {}, a warning is issued" do
- expect(Chef::Log).to receive(:deprecation).with( /^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 \{ \{\} \}\.$/, /property_spec\.rb/ )
- resource_class.class_eval("property :x, default: {}", __FILE__, __LINE__)
- expect(resource.x).to eq({})
- end
-
with_property ':x, default: lazy { {} }' do
it "when x is not set, it returns {}" do
expect(resource.x).to eq({})