diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/functional/resource/windows_task_spec.rb | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/spec/functional/resource/windows_task_spec.rb b/spec/functional/resource/windows_task_spec.rb index 05f46d20ce..a4cee114f4 100644 --- a/spec/functional/resource/windows_task_spec.rb +++ b/spec/functional/resource/windows_task_spec.rb @@ -61,14 +61,14 @@ describe Chef::Resource::WindowsTask, :windows_only do expect(subject).not_to be_updated_by_last_action end - it "creates scheduled task and sets command arguments" do + it "creates scheduled task and sets command arguments when arguments inclusive single quotes" do subject.command "chef-client -W -L 'C:\\chef\\chef-ad-join.log'" 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.application_name).to eq("chef-client") - expect(current_resource.task.parameters).to eq("-W -L C:\\\\chef\\\\chef-ad-join.log") + expect(current_resource.task.parameters).to eq("-W -L 'C:\\chef\\chef-ad-join.log'") end it "does not converge the resource if it is already converged" do @@ -79,20 +79,36 @@ describe Chef::Resource::WindowsTask, :windows_only do expect(subject).not_to be_updated_by_last_action end - it "creates scheduled task and sets command arguments" do - subject.command '"C:\\Program Files\\example\program.exe" -arg1 --arg2' + it "creates scheduled task and sets command arguments with spaces in command" do + subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2' 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.application_name).to eq("C:\\Program Files\\example\\program.exe") + expect(current_resource.task.application_name).to eq('"C:\\Program Files\\example\\program.exe"') expect(current_resource.task.parameters).to eq("-arg1 --arg2") end it "does not converge the resource if it is already converged" do - subject.command '"C:\\Program Files\\example\program.exe" -arg1 --arg2' + subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2' + subject.run_action(:create) + subject.command '"C:\\Program Files\\example\\program.exe" -arg1 --arg2' + subject.run_action(:create) + expect(subject).not_to be_updated_by_last_action + end + + it "creates scheduled task and sets command arguments with spaces in arguments" do + subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"' + call_for_create_action + current_resource = call_for_load_current_resource + expect(current_resource.exists).to eq(true) + expect(current_resource.task.application_name).to eq("powershell.exe") + expect(current_resource.task.parameters).to eq('-file "C:\\Program Files\\app\\script.ps1"') + end + + it "does not converge the resource if it is already converged" do + subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"' subject.run_action(:create) - subject.command '"C:\\Program Files\\example\program.exe" -arg1 --arg2' + subject.command 'powershell.exe -file "C:\\Program Files\\app\\script.ps1"' subject.run_action(:create) expect(subject).not_to be_updated_by_last_action end |