summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-02-20 15:22:27 -0800
committerTim Smith <tsmith@chef.io>2018-02-20 15:22:27 -0800
commitc31f425c0a64d07b83e598ab5927b0bb8d48dc63 (patch)
treeb34ce7355bca2ecca71decf68e48f9cf8f8c38f0
parent89a2601cd37ff2f5a00fced46d767515210561cd (diff)
downloadchef-c31f425c0a64d07b83e598ab5927b0bb8d48dc63.tar.gz
Add specs for the value coerce
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--spec/unit/resource/macos_user_defaults_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/resource/macos_user_defaults_spec.rb b/spec/unit/resource/macos_user_defaults_spec.rb
index 8787cd0b9a..6ef82853cc 100644
--- a/spec/unit/resource/macos_user_defaults_spec.rb
+++ b/spec/unit/resource/macos_user_defaults_spec.rb
@@ -28,4 +28,18 @@ describe Chef::Resource::MacosUserDefaults do
it "has a default action of install" do
expect(resource.action).to eql([:write])
end
+
+ [true, "TRUE", "1", "true", "YES", "yes"].each do |val|
+ it "coerces value property from #{val} to 1" do
+ resource.value val
+ expect(resource.value).to eql(1)
+ end
+ end
+
+ [false, "FALSE", "0", "false", "NO", "no"].each do |val|
+ it "coerces value property from #{val} to 0" do
+ resource.value val
+ expect(resource.value).to eql(0)
+ end
+ end
end