diff options
author | Tim Smith <tsmith@chef.io> | 2017-12-11 10:00:43 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 10:00:43 -0800 |
commit | 50c50322f0d7270b98cf62133bb109860e9f2223 (patch) | |
tree | 5d08c68f684ef5b6ecbb09813b645b2f174c9b25 /spec | |
parent | 72aa31170d09af49405c259434e32e7b1ce7acfa (diff) | |
parent | 93cc046e9afad04f41133376e7ba07aee994784d (diff) | |
download | chef-50c50322f0d7270b98cf62133bb109860e9f2223.tar.gz |
Merge pull request #6618 from MsysTechnologiesllc/nim/on_logon_issue
Invalid date error on windows_task with frequency :on_logon
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/windows_task_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/provider/windows_task_spec.rb b/spec/unit/provider/windows_task_spec.rb index d45531f3dc..9a73f4f07f 100644 --- a/spec/unit/provider/windows_task_spec.rb +++ b/spec/unit/provider/windows_task_spec.rb @@ -137,6 +137,22 @@ describe Chef::Provider::WindowsTask do expect(new_resource).to be_updated_by_last_action end + context "when start_day and start_time are N/A for frequency :on_logon" do + it "doesn't update the start_day and start_time of new_resource" do + task_hash[:on_logon] = true + task_hash[:StartDate] = "N/A" + task_hash[:StartTime] = "N/A" + allow(provider).to receive(:load_task_hash).and_return(task_hash) + current_resource = provider.load_current_resource + allow(provider).to receive(:task_need_update?).and_return(true) + allow(provider).to receive(:run_schtasks) + expect(provider).not_to receive(:convert_system_date_to_mm_dd_yyyy) + expect(DateTime).not_to receive(:parse) + expect(new_resource.start_day).to eq(nil) + expect(new_resource.start_time).to eq(nil) + end + end + context "when task is not existing" do before do allow(provider).to receive(:load_task_hash) |