summaryrefslogtreecommitdiff
path: root/spec/functional
diff options
context:
space:
mode:
authorBryan McLellan <btm@loftninjas.org>2018-11-01 16:47:43 -0400
committerGitHub <noreply@github.com>2018-11-01 16:47:43 -0400
commit1b13f02dce754ad0d959bc56b8518c46e29ea5a0 (patch)
treec3ab3548e540ae82202a2452ec92cf21071b940e /spec/functional
parentdafb29b48a322ba5480fe7315708d5bbb552424e (diff)
parentc61bcb5ff071400ca90f0db125ef7eab3bb1fe4f (diff)
downloadchef-1b13f02dce754ad0d959bc56b8518c46e29ea5a0.tar.gz
Merge pull request #7777 from MsysTechnologiesllc/Kapil/MSYS-913_add_description_property
Added property `description` on windows_task resource
Diffstat (limited to 'spec/functional')
-rw-r--r--spec/functional/resource/windows_task_spec.rb39
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)