diff options
author | kapil chouhan <kapil.chouhan@msystechnologies.com> | 2018-10-25 09:19:49 +0000 |
---|---|---|
committer | Kapil Chouhan <kapil.chouhan@msystechnologies.com> | 2018-10-30 16:26:09 +0530 |
commit | c61bcb5ff071400ca90f0db125ef7eab3bb1fe4f (patch) | |
tree | 992f6875b3426d88f14fd6cf1916037a63f9690a /spec/functional | |
parent | c6f0eb055601ac50c9b1c24ba815329bccfc7605 (diff) | |
download | chef-c61bcb5ff071400ca90f0db125ef7eab3bb1fe4f.tar.gz |
- Added `description` property on windows_task resource
Signed-off-by: kapil chouhan <kapil.chouhan@msystechnologies.com>
Diffstat (limited to 'spec/functional')
-rw-r--r-- | spec/functional/resource/windows_task_spec.rb | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/spec/functional/resource/windows_task_spec.rb b/spec/functional/resource/windows_task_spec.rb index cb14da80d8..9b355d37ed 100644 --- a/spec/functional/resource/windows_task_spec.rb +++ b/spec/functional/resource/windows_task_spec.rb @@ -132,6 +132,45 @@ describe Chef::Resource::WindowsTask, :windows_only do end end + context "when description is passed" do + subject do + new_resource = Chef::Resource::WindowsTask.new(task_name, run_context) + new_resource.execution_time_limit = 259200 / 60 # converting "PT72H" into minutes and passing here since win32-taskscheduler accespts this + new_resource.command task_name + # Make sure MM/DD/YYYY is accepted + new_resource.start_day "09/20/2017" + new_resource.frequency :hourly + new_resource + end + + let(:some_description) { "this is test description" } + + it "create the task and sets its description" do + subject.description some_description + call_for_create_action + # loading current resource again to check new task is creted and it matches task parameters + current_resource = call_for_load_current_resource + expect(current_resource.exists).to eq(true) + expect(current_resource.task.description).to eq(some_description) + end + + it "does not converge the resource if it is already converged" do + subject.description some_description + subject.run_action(:create) + subject.description some_description + subject.run_action(:create) + expect(subject).not_to be_updated_by_last_action + end + + it "updates task with new description if task already exist" do + subject.description some_description + subject.run_action(:create) + subject.description "test description" + subject.run_action(:create) + expect(subject).to be_updated_by_last_action + end + end + context "when frequency_modifier are not passed" do subject do new_resource = Chef::Resource::WindowsTask.new(task_name, run_context) |