diff options
Diffstat (limited to 'spec/unit/util/powershell/ps_credential_spec.rb')
-rw-r--r-- | spec/unit/util/powershell/ps_credential_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/unit/util/powershell/ps_credential_spec.rb b/spec/unit/util/powershell/ps_credential_spec.rb index bac58b02e5..668ec525c6 100644 --- a/spec/unit/util/powershell/ps_credential_spec.rb +++ b/spec/unit/util/powershell/ps_credential_spec.rb @@ -21,7 +21,7 @@ require 'chef/util/powershell/ps_credential' describe Chef::Util::Powershell::PSCredential do let (:username) { 'foo' } - let (:password) { 'password' } + let (:password) { 'ThIsIsThEpAsSwOrD' } context 'when username and password are provided' do let(:ps_credential) { Chef::Util::Powershell::PSCredential.new(username, password)} @@ -33,5 +33,12 @@ describe Chef::Util::Powershell::PSCredential do "'#{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') + expect(ps_credential.to_text).not_to match(/#{password}/) + end + end end end |