diff options
author | mwrock <matt@mattwrock.com> | 2020-10-05 11:07:06 -0700 |
---|---|---|
committer | mwrock <matt@mattwrock.com> | 2020-10-05 11:07:06 -0700 |
commit | 2bb4a762ba583f973c5528e9cb229236441623f8 (patch) | |
tree | cc9a3b61a149c2977f7dcadf15c923753da6ea07 | |
parent | b49989ec194585f517482260a9c499eb6f1d2ed5 (diff) | |
download | chef-2bb4a762ba583f973c5528e9cb229236441623f8.tar.gz |
fix specs on powershell v4 and below
Signed-off-by: mwrock <matt@mattwrock.com>
-rw-r--r-- | spec/functional/mixin/powershell_out_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/mixin/powershell_exec_spec.rb | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/spec/functional/mixin/powershell_out_spec.rb b/spec/functional/mixin/powershell_out_spec.rb index d9b5c69cd6..22df0f92c9 100644 --- a/spec/functional/mixin/powershell_out_spec.rb +++ b/spec/functional/mixin/powershell_out_spec.rb @@ -27,7 +27,7 @@ describe Chef::Mixin::PowershellOut, :windows_only do end it "uses :powershell by default" do - expect(powershell_out("$PSVersionTable").run_command.stdout).to match /Desktop/ + expect(powershell_out("$PSVersionTable").run_command.stdout).to match /CLRVersion/ end it ":pwsh interpreter uses core edition", :pwsh_installed do diff --git a/spec/unit/mixin/powershell_exec_spec.rb b/spec/unit/mixin/powershell_exec_spec.rb index 10614581cd..e00fb667a2 100644 --- a/spec/unit/mixin/powershell_exec_spec.rb +++ b/spec/unit/mixin/powershell_exec_spec.rb @@ -29,9 +29,9 @@ describe Chef::Mixin::PowershellExec, :windows_only, :windows_gte_10 do expect(object.powershell_exec("$PSVersionTable")).to be_kind_of(Chef::PowerShell) end - it "uses the Desktop edition" do + it "uses less than version 6" do execution = object.powershell_exec("$PSVersionTable") - expect(execution.result["PSEdition"]).to eql("Desktop") + expect(execution.result["PSVersion"].to_s.to_i).to be < 6 end end @@ -40,9 +40,9 @@ describe Chef::Mixin::PowershellExec, :windows_only, :windows_gte_10 do expect(object.powershell_exec("$PSVersionTable", :pwsh)).to be_kind_of(Chef::Pwsh) end - it "uses the Desktop edition" do + it "uses greater than version 6" do execution = object.powershell_exec("$PSVersionTable", :pwsh) - expect(execution.result["PSEdition"]).to eql("Core") + expect(execution.result["PSVersion"]["Major"]).to be > 6 end end @@ -51,9 +51,9 @@ describe Chef::Mixin::PowershellExec, :windows_only, :windows_gte_10 do expect(object.powershell_exec("$PSVersionTable", :powershell)).to be_kind_of(Chef::PowerShell) end - it "uses the Desktop edition" do + it "uses less than version 6" do execution = object.powershell_exec("$PSVersionTable", :powershell) - expect(execution.result["PSEdition"]).to eql("Desktop") + expect(execution.result["PSVersion"].to_s.to_i).to be < 6 end end |