diff options
author | Thom May <thom@chef.io> | 2018-02-12 15:10:53 +0000 |
---|---|---|
committer | Thom May <thom@chef.io> | 2018-02-12 17:36:27 +0000 |
commit | edba4de26a16e5445a803814c2703f10e6317d12 (patch) | |
tree | 078ff7c725d1ea3d6f6a57fc9a25ed85f3024a08 /spec/unit/property/validation_spec.rb | |
parent | 6f6cfab7e24e3626fa9d21033653730ec7780009 (diff) | |
download | chef-edba4de26a16e5445a803814c2703f10e6317d12.tar.gz |
Implement RFC 101: Custom Validation Messages
Adds validation_message as a property option
Signed-off-by: Thom May <thom@chef.io>
Diffstat (limited to 'spec/unit/property/validation_spec.rb')
-rw-r--r-- | spec/unit/property/validation_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/unit/property/validation_spec.rb b/spec/unit/property/validation_spec.rb index 13afcdfbc2..882ea3353b 100644 --- a/spec/unit/property/validation_spec.rb +++ b/spec/unit/property/validation_spec.rb @@ -699,4 +699,13 @@ describe "Chef::Resource.property validation" do end end end + + context "custom validation messages" do + with_property ":x, String, validation_message: 'Must be a string, fool'" do + it "raise with the correct error message" do + expect { resource.x 1 }.to raise_error Chef::Exceptions::ValidationFailed, + "Must be a string, fool" + end + end + end end |