summaryrefslogtreecommitdiff
path: root/spec/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit')
-rw-r--r--spec/unit/provider/powershell_script_spec.rb11
-rw-r--r--spec/unit/resource/powershell_script_spec.rb4
2 files changed, 13 insertions, 2 deletions
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb
index 1c49c52160..0bece73bd0 100644
--- a/spec/unit/provider/powershell_script_spec.rb
+++ b/spec/unit/provider/powershell_script_spec.rb
@@ -46,5 +46,16 @@ describe Chef::Provider::PowershellScript, "action_run" do
expect(provider.command).to eq(expected)
end
+
+ it "uses pwsh when given the pwsh interpreter" do
+ new_resource.interpreter = "pwsh"
+ provider.send(:script_file_path=, "C:\\Temp\\Script.ps1")
+
+ expected = <<~CMD.strip
+ "pwsh" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:\\Temp\\Script.ps1"
+ CMD
+
+ expect(provider.command).to eq(expected)
+ end
end
end
diff --git a/spec/unit/resource/powershell_script_spec.rb b/spec/unit/resource/powershell_script_spec.rb
index 9bc91204be..75fdf6ffc6 100644
--- a/spec/unit/resource/powershell_script_spec.rb
+++ b/spec/unit/resource/powershell_script_spec.rb
@@ -53,9 +53,9 @@ describe Chef::Resource::PowershellScript do
allow(resource).to receive(:updated).and_return(true)
end
- it "inherits exactly the :cwd, :environment, :group, :path, :user, :umask, :architecture, :elevated properties from a parent resource class" do
+ it "inherits exactly the :cwd, :environment, :group, :path, :user, :umask, :architecture, :elevated, :interpreter properties from a parent resource class" do
inherited_difference = Chef::Resource::PowershellScript.guard_inherited_attributes -
- %i{cwd environment group path user umask architecture elevated}
+ %i{cwd environment group path user umask architecture elevated interpreter}
expect(inherited_difference).to eq([])
end