Sha256: 4a405e3557629ea496a13ab884cf1eb654209bfa54e493abfd39d270d7aee31a
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
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" } @orig_stdout = $stdout $stdout = File.open(File::NULL, 'w') end after do $stdout = @orig_stdout 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 it "returns the value of the 'id' parameter" do expect(user['id']).to eq 'bar' end end describe 'decrypt_password' do it 'echoes warning' do expect { user.decrypt_password } .to output("WARNING: This method is deprecated, please switch to item['value'] calls\n") .to_stdout 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.6.1 | spec/chef-vault/user_spec.rb |