Sha256: 75499ef5248f301b1c7e73289c5fe0cb7e6f8b5647602a233e51234a987a6355

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe Picky::Backends::Redis::Basic do

  let(:client) { double :client }

  context 'without options' do
    let(:backend) { described_class.new client, :some_namespace }

    describe 'load, retrieve, delete' do
      it 'is nothing they do (at least on the backend)' do
        backend.should_receive(:client).never

        backend.load false
        backend.retrieve
      end
    end

    describe 'empty' do
      it 'returns the container that is used for backending' do
        backend.empty.should == {}
      end
    end

    describe 'initial' do
      it 'is correct' do
        backend.initial.should == {}
      end
    end

    describe 'to_s' do
      it 'returns the cache path with the default file extension' do
        backend.to_s.should == 'Picky::Backends::Redis::Basic(some_namespace:*)'
      end
    end
  end

  context 'with options' do
    let(:backend) do
      described_class.new client,
                          :some_namespace,
                          empty: [],
                          initial: []
    end

    describe 'empty' do
      it 'returns the container that is used for backending' do
        backend.empty.should == []
      end
    end

    describe 'initial' do
      it 'is correct' do
        backend.initial.class.should == Array
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
picky-4.31.3 spec/lib/backends/redis/basic_spec.rb
picky-4.31.2 spec/lib/backends/redis/basic_spec.rb
picky-4.31.1 spec/lib/backends/redis/basic_spec.rb
picky-4.31.0 spec/lib/backends/redis/basic_spec.rb