diff options
author | Matt Wrock <matt@mattwrock.com> | 2017-05-10 09:12:02 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-10 09:12:02 -0700 |
commit | bb6682036fcdb119fa1f7701543eec191c08170b (patch) | |
tree | 678f9636d5f6feef87c1adf8500ccb64bf400ade | |
parent | c4c327d2b11179c1a6086e991ff6af73b3ad72d2 (diff) | |
parent | 7639b054ab953e196d94b40d55fda21ac7f413b2 (diff) | |
download | chef-bb6682036fcdb119fa1f7701543eec191c08170b.tar.gz |
Merge pull request #6105 from Stromweld/patch-1
Updated to fix day validation with monthly frequency
-rw-r--r-- | lib/chef/resource/windows_task.rb | 4 | ||||
-rw-r--r-- | spec/unit/resource/windows_task_spec.rb | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb index 52dec381e0..f9c0599c49 100644 --- a/lib/chef/resource/windows_task.rb +++ b/lib/chef/resource/windows_task.rb @@ -161,8 +161,8 @@ class Chef end def validate_create_day(day, frequency) - unless [:weekly].include?(frequency) - raise "day attribute is only valid for tasks that run weekly" + unless [:weekly, :monthly].include?(frequency) + raise "day attribute is only valid for tasks that run monthly or weekly" end if day.is_a?(String) && day.to_i.to_s != day days = day.split(",") diff --git a/spec/unit/resource/windows_task_spec.rb b/spec/unit/resource/windows_task_spec.rb index fa2d458bbb..2b3ee16024 100644 --- a/spec/unit/resource/windows_task_spec.rb +++ b/spec/unit/resource/windows_task_spec.rb @@ -166,8 +166,8 @@ describe Chef::Resource::WindowsTask do end context "#validate_create_day" do - it "raises error if frequency is not :weekly" do - expect { resource.send(:validate_create_day, "Mon", :monthly) }.to raise_error("day attribute is only valid for tasks that run weekly") + it "raises error if frequency is not :weekly or :monthly" do + expect { resource.send(:validate_create_day, "Mon", :once) }.to raise_error("day attribute is only valid for tasks that run monthly or weekly") end it "accepts a valid single day" do |