Sha256: 3864aa316bf282c8fc3e51bbf8cdda7f370f6a217bdef5a6842973f47211afcd

Contents?: true

Size: 629 Bytes

Versions: 6

Compression:

Stored size: 629 Bytes

Contents

require 'perforated'

describe Perforated::Compatibility do
  after { Perforated.cache = nil }

  describe '.fetch_multi' do
    it 'uses the fetch_multi method on the configured cache if present' do
      Perforated.cache = double(:store)

      expect(Perforated.cache).to receive(:fetch_multi).with(:one, :two)

      Perforated::Compatibility.fetch_multi(:one, :two) { |key| key }
    end

    it 'falls back to the custom backfill if the cache does not support it' do
      results = Perforated::Compatibility.fetch_multi(:one, :two) { |key| key.to_s }

      expect(results).to eq(one: 'one', two: 'two')
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
perforated-0.10.1 spec/perforated/compatibility/fetch_multi_spec.rb
perforated-0.10.0 spec/perforated/compatibility/fetch_multi_spec.rb
perforated-0.9.1 spec/perforated/compatibility/fetch_multi_spec.rb
perforated-0.9.0 spec/perforated/compatibility/fetch_multi_spec.rb
perforated-0.8.2 spec/perforated/compatibility/fetch_multi_spec.rb
perforated-0.8.1 spec/perforated/compatibility/fetch_multi_spec.rb