Sha256: 82918519ca3098e083a92de81bb75d373a6d5c7c8c2ecca55cff70887eb00b29
Contents?: true
Size: 939 Bytes
Versions: 1
Compression:
Stored size: 939 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.5.0 | spec/chef-vault/user_spec.rb |