summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authordheerajd-msys <dheeraj.dubey@msystechnologies.com>2017-12-26 15:05:35 +0530
committerdheerajd-msys <dheeraj.dubey@msystechnologies.com>2018-01-16 16:13:49 +0530
commit0f71e2d0a67357fa069607dd3ef3554e436bf646 (patch)
tree334f0873515fa420526db1b4e6d5f56ad7b0d896 /spec
parentfcd8d778baeeb990a64fe9042164bbd3e1dd5269 (diff)
downloadchef-0f71e2d0a67357fa069607dd3ef3554e436bf646.tar.gz
fix validation for idle_time
Signed-off-by: dheerajd-msys <dheeraj.dubey@msystechnologies.com>
Diffstat (limited to 'spec')
-rw-r--r--spec/unit/resource/windows_task_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/unit/resource/windows_task_spec.rb b/spec/unit/resource/windows_task_spec.rb
index 145063b53e..18a4960d90 100644
--- a/spec/unit/resource/windows_task_spec.rb
+++ b/spec/unit/resource/windows_task_spec.rb
@@ -278,6 +278,14 @@ describe Chef::Resource::WindowsTask do
it "raises error if idle_time > 999" do
expect { resource.send(:validate_idle_time, 1000, :on_idle) }.to raise_error(ArgumentError, "idle_time value 1000 is invalid. Valid values for :on_idle frequency are 1 - 999.")
end
+
+ it "raises error if idle_time < 0" do
+ expect { resource.send(:validate_idle_time, -5, :on_idle) }.to raise_error(ArgumentError, "idle_time value -5 is invalid. Valid values for :on_idle frequency are 1 - 999.")
+ end
+
+ it "raises error if idle_time is not set" do
+ expect { resource.send(:validate_idle_time, nil, :on_idle) }.to raise_error(ArgumentError, "idle_time value should be set for :on_idle frequency.")
+ end
end
context "#sec_to_dur" do