Sha256: b6946bded075ed5ebf916e87094c6fb885f4b7adaf4a84ec30ecc5777b161bec
Contents?: true
Size: 1016 Bytes
Versions: 15
Compression:
Stored size: 1016 Bytes
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" } 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(ChefVault::Log).to receive(:warn).with("This method is deprecated, please switch to item['value'] calls") cert.decrypt_contents 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
15 entries across 15 versions & 1 rubygems