@@ -178,8 +178,12 @@ def close_stream(stream, style = :inprocess)
178178 expect_different_manager_returned_than ( manager , first_pid )
179179 end
180180
181- context "on Windows" , :if => Puppet :: Util :: Platform . windows? do
181+ context "on Windows" do
182182 # On Windows we're using named pipes so these tests only apply on Windows.
183+ before :each do
184+ skip ( 'Not on Windows platform' ) unless Puppet ::Util ::Platform . windows?
185+ end
186+
183187 it "should create a new PowerShell manager host if the input stream is closed" do
184188 first_pid = manager . execute ( '[Diagnostics.Process]::GetCurrentProcess().Id' ) [ :stdout ]
185189
@@ -655,12 +659,13 @@ def output_cmdlet(ps_command, ps_args)
655659 expect ( result [ :errormessage ] ) . to match ( /Working directory .+ does not exist/ )
656660 end
657661
658- it "should allow forward slashes in working directory" , :if => Puppet ::Util ::Platform . windows? do
662+ it "should allow forward slashes in working directory" do
663+ skip ( 'Not on Windows platform' ) unless Puppet ::Util ::Platform . windows?
659664 # Backslashes only apply on Windows filesystems
660665 work_dir = ENV [ "WINDIR" ]
661666 forward_work_dir = work_dir . gsub ( '\\' , '/' )
662667
663- result = manager . execute ( '(Get-Location).Path' , nil , work_dir ) [ :stdout ]
668+ result = manager . execute ( '(Get-Location).Path' , nil , forward_work_dir ) [ :stdout ]
664669
665670 expect ( result ) . to eq ( "#{ work_dir } #{ line_end } " )
666671 end
@@ -810,18 +815,22 @@ def output_cmdlet(ps_command, ps_args)
810815end
811816end
812817
813- if Puppet ::Util ::Platform . windows? && PuppetX ::PowerShell ::PowerShellManager . supported?
814- describe "On Windows PowerShell" do
815- it_should_behave_like "a PowerShellManager" ,
816- Puppet ::Type . type ( :exec ) . provider ( :powershell ) . command ( :powershell ) ,
817- Puppet ::Type . type ( :exec ) . provider ( :powershell ) . powershell_args
818+ describe "On Windows PowerShell" do
819+ before :each do
820+ skip unless Puppet ::Util ::Platform . windows? && PuppetX ::PowerShell ::PowerShellManager . supported?
818821 end
822+
823+ it_should_behave_like "a PowerShellManager" ,
824+ Puppet ::Type . type ( :exec ) . provider ( :powershell ) . command ( :powershell ) ,
825+ Puppet ::Type . type ( :exec ) . provider ( :powershell ) . powershell_args
819826end
820827
821- if PuppetX ::PowerShell ::PowerShellManager . supported_on_pwsh? && !Puppet ::Type . type ( :exec ) . provider ( :pwsh ) . new ( ) . get_pwsh_command . nil?
822- describe "On PowerShell Core" do
823- it_should_behave_like "a PowerShellManager" ,
824- Puppet ::Type . type ( :exec ) . provider ( :pwsh ) . new ( ) . get_pwsh_command ,
825- Puppet ::Type . type ( :exec ) . provider ( :pwsh ) . new ( ) . pwsh_args
828+ describe "On PowerShell Core" do
829+ before :each do
830+ skip unless PuppetX ::PowerShell ::PowerShellManager . supported_on_pwsh? && !Puppet ::Type . type ( :exec ) . provider ( :pwsh ) . new ( ) . get_pwsh_command . nil?
826831 end
832+
833+ it_should_behave_like "a PowerShellManager" ,
834+ Puppet ::Type . type ( :exec ) . provider ( :pwsh ) . new ( ) . get_pwsh_command ,
835+ Puppet ::Type . type ( :exec ) . provider ( :pwsh ) . new ( ) . pwsh_args
827836end
0 commit comments