diff options
Diffstat (limited to 'spec/unit/provider/powershell_script_spec.rb')
-rw-r--r-- | spec/unit/provider/powershell_script_spec.rb | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/spec/unit/provider/powershell_script_spec.rb b/spec/unit/provider/powershell_script_spec.rb index 121973763d..c4a712d69a 100644 --- a/spec/unit/provider/powershell_script_spec.rb +++ b/spec/unit/provider/powershell_script_spec.rb @@ -16,7 +16,7 @@ # limitations under the License. # -require 'spec_helper' +require "spec_helper" describe Chef::Provider::PowershellScript, "action_run" do let(:powershell_version) { nil } @@ -33,12 +33,12 @@ describe Chef::Provider::PowershellScript, "action_run" do let(:provider) { empty_events = Chef::EventDispatch::Dispatcher.new run_context = Chef::RunContext.new(node, {}, empty_events) - new_resource = Chef::Resource::PowershellScript.new('run some powershell code', run_context) + new_resource = Chef::Resource::PowershellScript.new("run some powershell code", run_context) Chef::Provider::PowershellScript.new(new_resource, run_context) } - context 'when setting interpreter flags' do - context 'on nano' do + context "when setting interpreter flags" do + context "on nano" do before(:each) do allow(Chef::Platform).to receive(:windows_nano_server?).and_return(true) allow(provider).to receive(:is_forced_32bit).and_return(false) @@ -48,12 +48,12 @@ describe Chef::Provider::PowershellScript, "action_run" do end it "sets the -Command flag as the last flag" do - flags = provider.command.split(' ').keep_if { |flag| flag =~ /^-/ } + flags = provider.command.split(" ").keep_if { |flag| flag =~ /^-/ } expect(flags.pop).to eq("-Command") end end - context 'not on nano' do + context "not on nano" do before(:each) do allow(Chef::Platform).to receive(:windows_nano_server?).and_return(false) allow(provider).to receive(:is_forced_32bit).and_return(false) @@ -63,36 +63,36 @@ describe Chef::Provider::PowershellScript, "action_run" do end it "sets the -File flag as the last flag" do - flags = provider.command.split(' ').keep_if { |flag| flag =~ /^-/ } + flags = provider.command.split(" ").keep_if { |flag| flag =~ /^-/ } expect(flags.pop).to eq("-File") end let(:execution_policy_flag) do execution_policy_index = 0 - provider_flags = provider.flags.split(' ') + provider_flags = provider.flags.split(" ") execution_policy_specified = false provider_flags.find do | value | execution_policy_index += 1 - execution_policy_specified = value.downcase == '-ExecutionPolicy'.downcase + execution_policy_specified = value.downcase == "-ExecutionPolicy".downcase end execution_policy = execution_policy_specified ? provider_flags[execution_policy_index] : nil end - context 'when running with an unspecified PowerShell version' do + context "when running with an unspecified PowerShell version" do let(:powershell_version) { nil } it "sets the -ExecutionPolicy flag to 'Unrestricted' by default" do - expect(execution_policy_flag.downcase).to eq('unrestricted'.downcase) + expect(execution_policy_flag.downcase).to eq("unrestricted".downcase) end end - { '2.0' => 'Unrestricted', - '2.5' => 'Unrestricted', - '3.0' => 'Bypass', - '3.6' => 'Bypass', - '4.0' => 'Bypass', - '5.0' => 'Bypass' }.each do | version_policy | + { "2.0" => "Unrestricted", + "2.5" => "Unrestricted", + "3.0" => "Bypass", + "3.6" => "Bypass", + "4.0" => "Bypass", + "5.0" => "Bypass" }.each do | version_policy | let(:powershell_version) { version_policy[0].to_f } context "when running PowerShell version #{version_policy[0]}" do let(:powershell_version) { version_policy[0].to_f } |