summaryrefslogtreecommitdiff
path: root/spec/unit/property_spec.rb
diff options
context:
space:
mode:
authorJohn Keiser <john@johnkeiser.com>2016-01-29 16:11:28 -0800
committerJohn Keiser <john@johnkeiser.com>2016-02-01 12:23:18 -0800
commit862a85015b841b15541eeb372a642ab50ca210a9 (patch)
tree52e63646efa60a9769e6cb5efb802e32b7ab525c /spec/unit/property_spec.rb
parentabc81c0eb35a73e15217371c37235d5f13f55df7 (diff)
downloadchef-862a85015b841b15541eeb372a642ab50ca210a9.tar.gz
Fix defaults on property_type
Diffstat (limited to 'spec/unit/property_spec.rb')
-rw-r--r--spec/unit/property_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index ffdbccf019..2ff266f0ca 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -1096,6 +1096,21 @@ describe "Chef::Resource.property" do
/Cannot specify both name_property and name_attribute together on property x of resource chef_resource_property_spec_(\d+)./
end
+ it "property_types validate their defaults" do
+ expect {
+ module PropertySpecPropertyTypes
+ include Chef::Mixin::Properties
+ property_type(is: [:a, :b], default: :c)
+ end
+ }.to raise_error(Chef::Exceptions::DeprecatedFeatureError, /Default value :c is invalid for property <property type>./)
+ expect {
+ module PropertySpecPropertyTypes
+ include Chef::Mixin::Properties
+ property_type(is: [:a, :b], default: :b)
+ end
+ }.not_to raise_error
+ end
+
context "with a custom property type" do
class CustomPropertyType < Chef::Property
end