diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-02-09 10:10:50 -0800 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-03-20 14:38:02 -0700 |
commit | dcd2aa426eac334cec2b4fe751b6547eb04c973d (patch) | |
tree | f68c8a046d60eba672e3f6038a492b1d84ce03e0 /spec/unit/resource/dsc_resource_spec.rb | |
parent | 4de6d1563b05be678df7ed7264e8c83ed0657f25 (diff) | |
download | chef-dcd2aa426eac334cec2b4fe751b6547eb04c973d.tar.gz |
Added test for ensuring property_name is a Symbol in DscResource
Diffstat (limited to 'spec/unit/resource/dsc_resource_spec.rb')
-rw-r--r-- | spec/unit/resource/dsc_resource_spec.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/spec/unit/resource/dsc_resource_spec.rb b/spec/unit/resource/dsc_resource_spec.rb index 464529035c..aea4feec42 100644 --- a/spec/unit/resource/dsc_resource_spec.rb +++ b/spec/unit/resource/dsc_resource_spec.rb @@ -47,10 +47,18 @@ describe Chef::Resource::DscResource do expect(dsc_test_resource.resource).to eq(dsc_test_resource_name) end - it "allows setting a dsc property" do - dsc_test_resource.property(dsc_test_property_name, dsc_test_property_value) - expect(dsc_test_resource.property(dsc_test_property_name)).to eq(dsc_test_property_value) - expect(dsc_test_resource.properties[dsc_test_property_name]).to eq(dsc_test_property_value) + context "when setting a dsc property" do + it "allows setting a dsc property with a property name of type Symbol" do + dsc_test_resource.property(dsc_test_property_name, dsc_test_property_value) + expect(dsc_test_resource.property(dsc_test_property_name)).to eq(dsc_test_property_value) + expect(dsc_test_resource.properties[dsc_test_property_name]).to eq(dsc_test_property_value) + end + + it "raises a TypeError if property_name is not a symbol" do + expect{ + dsc_test_resource.property('Foo', dsc_test_property_value) + }.to raise_error(TypeError) + end end end end |