Sha256: c05f7d87c46e310793bc2ceaaf252869abf4bbcf108ca2daaf06bfad0415951b
Contents?: true
Size: 941 Bytes
Versions: 1
Compression:
Stored size: 941 Bytes
Contents
RSpec.describe ChefVault::User do let(:item) { double(ChefVault::Item) } let(:user) { ChefVault::User.new("foo", "bar") } before do allow(ChefVault::Item).to receive(:load).with("foo", "bar"){ item } allow(item).to receive(:[]).with("id"){ "bar" } allow(item).to receive(:[]).with("password"){ "baz" } end describe '#new' do it 'loads item' do expect(ChefVault::Item).to receive(:load).with("foo", "bar") ChefVault::User.new("foo", "bar") end end describe '#[]' do specify { expect(user['id']).to eq 'bar' } end describe 'decrypt_password' do it 'echoes warning' do expect(STDOUT).to receive(:puts).with("WARNING: This method is deprecated, please switch to item['value'] calls") user.decrypt_password end it 'returns items password' do expect(item).to receive(:[]).with("password") expect(user.decrypt_password).to eq "baz" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chef-vault-2.4.0 | spec/chef-vault/user_spec.rb |