summaryrefslogtreecommitdiff
path: root/spec/functional/util/powershell/cmdlet_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/functional/util/powershell/cmdlet_spec.rb')
-rw-r--r--spec/functional/util/powershell/cmdlet_spec.rb30
1 files changed, 15 insertions, 15 deletions
diff --git a/spec/functional/util/powershell/cmdlet_spec.rb b/spec/functional/util/powershell/cmdlet_spec.rb
index 741d8a78d4..6ddbea2f42 100644
--- a/spec/functional/util/powershell/cmdlet_spec.rb
+++ b/spec/functional/util/powershell/cmdlet_spec.rb
@@ -19,18 +19,18 @@
require "chef/json_compat"
require File.expand_path("../../../../spec_helper", __FILE__)
-describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
+describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
before(:all) do
@node = Chef::Node.new
@node.consume_external_attrs(OHAI_SYSTEM.data, {})
end
let(:cmd_output_format) { :text }
- let(:simple_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-childitem", cmd_output_format, {:depth => 2}) }
+ let(:simple_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-childitem", cmd_output_format, { :depth => 2 }) }
let(:invalid_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-idontexist", cmd_output_format) }
- let(:cmdlet_get_item_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "get-item", cmd_output_format, {:depth => 2}) }
- let(:cmdlet_alias_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "alias", cmd_output_format, {:depth => 2}) }
+ let(:cmdlet_get_item_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "get-item", cmd_output_format, { :depth => 2 }) }
+ let(:cmdlet_alias_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "alias", cmd_output_format, { :depth => 2 }) }
let(:etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" }
- let(:architecture_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "$env:PROCESSOR_ARCHITECTURE")}
+ let(:architecture_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "$env:PROCESSOR_ARCHITECTURE") }
it "executes a simple process" do
result = simple_cmdlet.run
@@ -38,11 +38,11 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "#run does not raise a PowershellCmdletException exception if the command cannot be executed" do
- expect {invalid_cmdlet.run}.not_to raise_error
+ expect { invalid_cmdlet.run }.not_to raise_error
end
it "#run! raises a PowershellCmdletException exception if the command cannot be executed" do
- expect {invalid_cmdlet.run!}.to raise_error(Chef::Exceptions::PowershellCmdletException)
+ expect { invalid_cmdlet.run! }.to raise_error(Chef::Exceptions::PowershellCmdletException)
end
it "executes a 64-bit command on a 64-bit OS, 32-bit otherwise" do
@@ -58,17 +58,17 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "passes command line switches to the command" do
- result = cmdlet_alias_requires_switch_or_argument.run({:name => "ls"})
+ result = cmdlet_alias_requires_switch_or_argument.run({ :name => "ls" })
expect(result.succeeded?).to eq(true)
end
it "passes command line arguments to the command" do
- result = cmdlet_alias_requires_switch_or_argument.run({},{},"ls")
+ result = cmdlet_alias_requires_switch_or_argument.run({}, {}, "ls")
expect(result.succeeded?).to eq(true)
end
it "passes command line arguments and switches to the command" do
- result = cmdlet_get_item_requires_switch_or_argument.run({:path => etc_directory},{}," | select-object -property fullname | format-table -hidetableheaders")
+ result = cmdlet_get_item_requires_switch_or_argument.run({ :path => etc_directory }, {}, " | select-object -property fullname | format-table -hidetableheaders")
expect(result.succeeded?).to eq(true)
returned_directory = result.return_value
returned_directory.strip!
@@ -76,7 +76,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
end
it "passes execution options to the command" do
- result = cmdlet_get_item_requires_switch_or_argument.run({},{:cwd => etc_directory},". | select-object -property fullname | format-table -hidetableheaders")
+ result = cmdlet_get_item_requires_switch_or_argument.run({}, { :cwd => etc_directory }, ". | select-object -property fullname | format-table -hidetableheaders")
expect(result.succeeded?).to eq(true)
returned_directory = result.return_value
returned_directory.strip!
@@ -86,16 +86,16 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
context "when returning json" do
let(:cmd_output_format) { :json }
it "returns json format data" do
- result = cmdlet_alias_requires_switch_or_argument.run({},{},"ls")
+ result = cmdlet_alias_requires_switch_or_argument.run({}, {}, "ls")
expect(result.succeeded?).to eq(true)
- expect(lambda{Chef::JSONCompat.parse(result.return_value)}).not_to raise_error
+ expect(lambda { Chef::JSONCompat.parse(result.return_value) }).not_to raise_error
end
end
context "when returning Ruby objects" do
let(:cmd_output_format) { :object }
it "returns object format data" do
- result = simple_cmdlet.run({},{:cwd => etc_directory}, "hosts")
+ result = simple_cmdlet.run({}, { :cwd => etc_directory }, "hosts")
expect(result.succeeded?).to eq(true)
data = result.return_value
expect(data["Name"]).to eq("hosts")
@@ -105,7 +105,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
context "when constructor is given invalid arguments" do
let(:cmd_output_format) { :invalid }
it "throws an exception if an invalid format is passed to the constructor" do
- expect(lambda{simple_cmdlet}).to raise_error
+ expect(lambda { simple_cmdlet }).to raise_error
end
end
end