Sha256: 6e4b86f82ca6c6f1c5307120144b84216aa067d5e5213511fbca5d01eb53ac85

Contents?: true

Size: 508 Bytes

Versions: 2

Compression:

Stored size: 508 Bytes

Contents

require "spec_helper"

RSpec.describe Cachew::Null do
  let(:cachew) { described_class.new }

  describe ".new" do
    it "returns Singleton instance" do
      expect(cachew).to be described_class.new
    end
  end

  describe "#[]" do
    it "always evaluates given block" do
      expect { |b| cachew.fetch(:foo, &b) }.to yield_control
    end

    it "returns value of given block" do
      [:foo, :bar, :baz].each do |val|
        expect(cachew.fetch(:foo) { val }).to be val
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cachew-0.2.1 spec/lib/cachew/null_spec.rb
cachew-0.2.0 spec/lib/cachew/null_spec.rb