summaryrefslogtreecommitdiff
path: root/spec/unit/property_spec.rb
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2015-06-15 17:27:11 -0700
committerJohn Keiser <john@johnkeiser.com>2015-06-23 15:26:14 -0700
commit705e22b975196baa6decf23f9c3a7e676d6aefc4 (patch)
treebac88ce7328d23a9c31e6f49114249ac7f396985 /spec/unit/property_spec.rb
parent0a29c389d8dbc7c61fed13671e636480b8dd850e (diff)
downloadchef-705e22b975196baa6decf23f9c3a7e676d6aefc4.tar.gz
Freeze default constants
Diffstat (limited to 'spec/unit/property_spec.rb')
-rw-r--r--spec/unit/property_spec.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index 8c01bf7b49..326948713b 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -367,10 +367,14 @@ describe "Chef::Resource.property" do
expect(resource.x.object_id).to eq(value.object_id)
end
it "Multiple instances of x receive the exact same value" do
- # TODO this isn't really great behavior, but it's noted here so we find out
- # if it changed.
expect(resource.x.object_id).to eq(resource_class.new('blah2').x.object_id)
end
+ it "The default value is frozen" do
+ expect(resource.x).to be_frozen
+ end
+ it "The default value cannot be written to" do
+ expect { resource.x[:a] = 1 }.to raise_error RuntimeError, /frozen/
+ end
end
with_property ':x, default: lazy { {} }' do