diff options
Diffstat (limited to 'spec/unit/resource/powershell_script_spec.rb')
-rw-r--r-- | spec/unit/resource/powershell_script_spec.rb | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/spec/unit/resource/powershell_script_spec.rb b/spec/unit/resource/powershell_script_spec.rb index dc9b62b16c..5566f32725 100644 --- a/spec/unit/resource/powershell_script_spec.rb +++ b/spec/unit/resource/powershell_script_spec.rb @@ -23,7 +23,7 @@ describe Chef::Resource::PowershellScript do before(:each) do node = Chef::Node.new - node.default["kernel"] = Hash.new + node.default["kernel"] = {} node.default["kernel"][:machine] = :x86_64.to_s node.automatic[:os] = "windows" @@ -61,7 +61,7 @@ describe Chef::Resource::PowershellScript do it "inherits exactly the :cwd, :environment, :group, :path, :user, :umask, :architecture, :elevated properties from a parent resource class" do inherited_difference = Chef::Resource::PowershellScript.guard_inherited_attributes - - [:cwd, :environment, :group, :path, :user, :umask, :architecture, :elevated ] + %i{cwd environment group path user umask architecture elevated} expect(inherited_difference).to eq([]) end @@ -87,7 +87,8 @@ describe Chef::Resource::PowershellScript do it "enables convert_boolean_return by default for guards in the context of powershell_script when no guard params are specified" do allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:evaluate_action).and_return(true) allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with( - { convert_boolean_return: true, code: "$true" }).and_return(Proc.new {}) + { convert_boolean_return: true, code: "$true" } + ).and_return(Proc.new {}) resource.only_if("$true") end @@ -98,21 +99,24 @@ describe Chef::Resource::PowershellScript do file_resource.guard_interpreter :powershell_script allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with( - { convert_boolean_return: true, code: "$true" }).and_return(Proc.new {}) + { convert_boolean_return: true, code: "$true" } + ).and_return(Proc.new {}) resource.only_if("$true") end it "enables convert_boolean_return by default for guards in the context of powershell_script when guard params are specified" do guard_parameters = { cwd: "/etc/chef", architecture: :x86_64 } allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with( - { convert_boolean_return: true, code: "$true" }.merge(guard_parameters)).and_return(Proc.new {}) + { convert_boolean_return: true, code: "$true" }.merge(guard_parameters) + ).and_return(Proc.new {}) resource.only_if("$true", guard_parameters) end it "passes convert_boolean_return as true if it was specified as true in a guard parameter" do guard_parameters = { cwd: "/etc/chef", convert_boolean_return: true, architecture: :x86_64 } allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with( - { convert_boolean_return: true, code: "$true" }.merge(guard_parameters)).and_return(Proc.new {}) + { convert_boolean_return: true, code: "$true" }.merge(guard_parameters) + ).and_return(Proc.new {}) resource.only_if("$true", guard_parameters) end @@ -120,7 +124,8 @@ describe Chef::Resource::PowershellScript do other_guard_parameters = { cwd: "/etc/chef", architecture: :x86_64 } parameters_with_boolean_disabled = other_guard_parameters.merge({ convert_boolean_return: false, code: "$true" }) allow_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:block_from_attributes).with( - parameters_with_boolean_disabled).and_return(Proc.new {}) + parameters_with_boolean_disabled + ).and_return(Proc.new {}) resource.only_if("$true", parameters_with_boolean_disabled) end end |