summaryrefslogtreecommitdiff
path: root/spec/unit/util/powershell
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/util/powershell')
-rw-r--r--spec/unit/util/powershell/cmdlet_spec.rb44
-rw-r--r--spec/unit/util/powershell/ps_credential_spec.rb22
2 files changed, 33 insertions, 33 deletions
diff --git a/spec/unit/util/powershell/cmdlet_spec.rb b/spec/unit/util/powershell/cmdlet_spec.rb
index 5ddf9282c4..d2a7960db2 100644
--- a/spec/unit/util/powershell/cmdlet_spec.rb
+++ b/spec/unit/util/powershell/cmdlet_spec.rb
@@ -16,25 +16,25 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/powershell/cmdlet'
+require "chef"
+require "chef/util/powershell/cmdlet"
describe Chef::Util::Powershell::Cmdlet do
before (:all) do
@node = Chef::Node.new
- @cmdlet = Chef::Util::Powershell::Cmdlet.new(@node, 'Some-Commandlet')
+ @cmdlet = Chef::Util::Powershell::Cmdlet.new(@node, "Some-Commandlet")
end
describe '#validate_switch_name!' do
- it 'should not raise an error if a name contains all upper case letters' do
+ it "should not raise an error if a name contains all upper case letters" do
@cmdlet.send(:validate_switch_name!, "HELLO")
end
- it 'should not raise an error if the name contains all lower case letters' do
+ it "should not raise an error if the name contains all lower case letters" do
@cmdlet.send(:validate_switch_name!, "hello")
end
- it 'should not raise an error if no special characters are used except _' do
+ it "should not raise an error if no special characters are used except _" do
@cmdlet.send(:validate_switch_name!, "hello_world")
end
@@ -55,51 +55,51 @@ describe Chef::Util::Powershell::Cmdlet do
end
end
- it 'does not do anything to a string without special characters' do
- expect(@cmdlet.send(:escape_parameter_value, 'stuff')).to eql('stuff')
+ it "does not do anything to a string without special characters" do
+ expect(@cmdlet.send(:escape_parameter_value, "stuff")).to eql("stuff")
end
end
describe '#escape_string_parameter_value' do
it "surrounds a string with ''" do
- expect(@cmdlet.send(:escape_string_parameter_value, 'stuff')).to eql("'stuff'")
+ expect(@cmdlet.send(:escape_string_parameter_value, "stuff")).to eql("'stuff'")
end
end
describe '#command_switches_string' do
- it 'raises an ArgumentError if the key is not a symbol' do
+ it "raises an ArgumentError if the key is not a symbol" do
expect {
- @cmdlet.send(:command_switches_string, {'foo' => 'bar'})
+ @cmdlet.send(:command_switches_string, {"foo" => "bar"})
}.to raise_error(ArgumentError)
end
- it 'does not allow invalid switch names' do
+ it "does not allow invalid switch names" do
expect {
- @cmdlet.send(:command_switches_string, {:foo! => 'bar'})
+ @cmdlet.send(:command_switches_string, {:foo! => "bar"})
}.to raise_error(ArgumentError)
end
- it 'ignores switches with a false value' do
- expect(@cmdlet.send(:command_switches_string, {foo: false})).to eql('')
+ it "ignores switches with a false value" do
+ expect(@cmdlet.send(:command_switches_string, {foo: false})).to eql("")
end
- it 'should correctly handle a value type of string' do
- expect(@cmdlet.send(:command_switches_string, {foo: 'bar'})).to eql("-foo 'bar'")
+ it "should correctly handle a value type of string" do
+ expect(@cmdlet.send(:command_switches_string, {foo: "bar"})).to eql("-foo 'bar'")
end
- it 'should correctly handle a value type of string even when it is 0 length' do
- expect(@cmdlet.send(:command_switches_string, {foo: ''})).to eql("-foo ''")
+ it "should correctly handle a value type of string even when it is 0 length" do
+ expect(@cmdlet.send(:command_switches_string, {foo: ""})).to eql("-foo ''")
end
- it 'should not quote integers' do
+ it "should not quote integers" do
expect(@cmdlet.send(:command_switches_string, {foo: 1})).to eql("-foo 1")
end
- it 'should not quote floats' do
+ it "should not quote floats" do
expect(@cmdlet.send(:command_switches_string, {foo: 1.0})).to eql("-foo 1.0")
end
- it 'has just the switch when the value is true' do
+ it "has just the switch when the value is true" do
expect(@cmdlet.send(:command_switches_string, {foo: true})).to eql("-foo")
end
end
diff --git a/spec/unit/util/powershell/ps_credential_spec.rb b/spec/unit/util/powershell/ps_credential_spec.rb
index 668ec525c6..2ec7ff6238 100644
--- a/spec/unit/util/powershell/ps_credential_spec.rb
+++ b/spec/unit/util/powershell/ps_credential_spec.rb
@@ -16,27 +16,27 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/util/powershell/ps_credential'
+require "chef"
+require "chef/util/powershell/ps_credential"
describe Chef::Util::Powershell::PSCredential do
- let (:username) { 'foo' }
- let (:password) { 'ThIsIsThEpAsSwOrD' }
+ let (:username) { "foo" }
+ let (:password) { "ThIsIsThEpAsSwOrD" }
- context 'when username and password are provided' do
+ context "when username and password are provided" do
let(:ps_credential) { Chef::Util::Powershell::PSCredential.new(username, password)}
- context 'when calling to_psobject' do
- it 'should create the script to create a PSCredential when calling' do
- allow(ps_credential).to receive(:encrypt).with(password).and_return('encrypted')
+ context "when calling to_psobject" do
+ it "should create the script to create a PSCredential when calling" do
+ allow(ps_credential).to receive(:encrypt).with(password).and_return("encrypted")
expect(ps_credential.to_psobject).to eq(
"New-Object System.Management.Automation.PSCredential("\
"'#{username}',('encrypted' | ConvertTo-SecureString))")
end
end
- context 'when to_text is called' do
- it 'should not contain the password' do
- allow(ps_credential).to receive(:encrypt).with(password).and_return('encrypted')
+ context "when to_text is called" do
+ it "should not contain the password" do
+ allow(ps_credential).to receive(:encrypt).with(password).and_return("encrypted")
expect(ps_credential.to_text).not_to match(/#{password}/)
end
end