Sha256: ad1d60f431b5a69e0ad7ab43ec946375b7356a55cad4e6392a0ece1e35b2583b
Contents?: true
Size: 1.08 KB
Versions: 2
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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chef-vault-2.8.0.rc1 | spec/chef-vault/user_spec.rb |
chef-vault-2.7.1 | spec/chef-vault/user_spec.rb |