diff options
author | Adam Edwards <adamed@opscode.com> | 2014-06-14 20:59:44 -0700 |
---|---|---|
committer | Adam Edwards <adamed@opscode.com> | 2014-10-23 10:43:03 -0700 |
commit | b070d4796bb9b573c22ec6e094fea7e60d323718 (patch) | |
tree | df9296d8ffbb5a72aa4139c957e90d3ae0c42bab /spec/functional | |
parent | 94dc0364dfa99dba3a5dbfbefeb08f41926b5468 (diff) | |
download | chef-b070d4796bb9b573c22ec6e094fea7e60d323718.tar.gz |
powershell_script and batch resource guard_interpeter default to parent resource
Diffstat (limited to 'spec/functional')
-rw-r--r-- | spec/functional/resource/batch_spec.rb | 15 | ||||
-rw-r--r-- | spec/functional/resource/powershell_spec.rb | 7 |
2 files changed, 11 insertions, 11 deletions
diff --git a/spec/functional/resource/batch_spec.rb b/spec/functional/resource/batch_spec.rb index baa01ee5d9..39133fd40b 100644 --- a/spec/functional/resource/batch_spec.rb +++ b/spec/functional/resource/batch_spec.rb @@ -21,17 +21,10 @@ require 'spec_helper' describe Chef::Resource::WindowsScript::Batch, :windows_only do include_context Chef::Resource::WindowsScript - let(:script_content) { "whoami" } + let(:output_command) { ' > ' } - let!(:resource) do - Chef::Resource::WindowsScript::Batch.new("Batch resource functional test", @run_context) - end + let (:architecture_command) { '@echo %PROCESSOR_ARCHITECTURE%' } + + it_behaves_like "a Windows script running on Windows" - describe "when the run action is invoked on Windows" do - it "executes the script code" do - resource.code(script_content + " > #{script_output_path}") - resource.returns(0) - resource.run_action(:run) - end - end end diff --git a/spec/functional/resource/powershell_spec.rb b/spec/functional/resource/powershell_spec.rb index 96a356f441..a72a33d1a5 100644 --- a/spec/functional/resource/powershell_spec.rb +++ b/spec/functional/resource/powershell_spec.rb @@ -22,6 +22,12 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do include_context Chef::Resource::WindowsScript + let (:architecture_command) { 'echo $env:PROCESSOR_ARCHITECTURE' } + let (:output_command) { ' | out-file -encoding ASCII ' } + + it_behaves_like "a Windows script running on Windows" + + let(:successful_executable_script_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe $env:systemroot" } let(:failed_executable_script_content) { "#{ENV['SystemRoot']}\\system32\\attrib.exe /badargument" } let(:processor_architecture_script_content) { "echo $env:PROCESSOR_ARCHITECTURE" } @@ -36,6 +42,7 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do let(:arbitrary_nonzero_process_exit_code_content) { "exit #{arbitrary_nonzero_process_exit_code}" } let(:invalid_powershell_interpreter_flag) { "/thisflagisinvalid" } let(:valid_powershell_interpreter_flag) { "-Sta" } + let!(:resource) do r = Chef::Resource::WindowsScript::PowershellScript.new("Powershell resource functional test", @run_context) r.code(successful_executable_script_content) |