Sha256: c8bb0b9ffba151eb7e6c288bfcda0b1221a9305eeff68682605d6ed95f94b4df
Contents?: true
Size: 789 Bytes
Versions: 20
Compression:
Stored size: 789 Bytes
Contents
module Ddr::Models RSpec.describe Cache do describe "#get" do it "retrieves a value by key" do expect(subject.get(:foo)).to be_nil subject[:foo] = "bar" expect(subject.get(:foo)).to eq "bar" end end describe "#put" do it "inserts a key/value" do expect { subject.put(:foo, "bar") }.to change { subject[:foo] }.from(nil).to("bar") end end describe "#with" do it "returns the value of the block" do result = subject.with(foo: "bar") { 1 } expect(result).to eq 1 end it "temporarily caches the arguments" do subject.with(foo: "bar") do expect(subject.get(:foo)).to eq "bar" end expect(subject.get(:foo)).to be_nil end end end end
Version data entries
20 entries across 20 versions & 1 rubygems