Sha256: fd04bf0e15e6634165b31538ec70a3791f8f71ed619b21a5ed5624e79b650193
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
RSpec.describe ChefVault::Certificate do let(:item) { double(ChefVault::Item) } let(:cert) { ChefVault::Certificate.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("contents"){ "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::Certificate.new("foo", "bar") end end describe '#[]' do it "given an 'id' parameter, returns its value" do expect(cert["id"]).to eq "bar" end end describe "decrypt_contents" do it "echoes warning" do expect { cert.decrypt_contents } .to output("WARNING: This method is deprecated, please switch to item['value'] calls\n") .to_stdout end it "returns items contents" do expect(item).to receive(:[]).with("contents") expect(cert.decrypt_contents).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/certificate_spec.rb |
chef-vault-2.7.1 | spec/chef-vault/certificate_spec.rb |