Sha256: 396b9afb02df33aeff6fae6f0813fae3b9c880f28279642f34fcddccaf1049e7

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

require 'spec_helper'

shared_examples 'redis' do
  it_behaves_like 'compatibility'
  it_behaves_like 'hashes'
  it_behaves_like 'connection'
  it_behaves_like 'keys'
  it_behaves_like 'lists'
  it_behaves_like 'server'
  it_behaves_like 'sets'
  it_behaves_like 'strings'
  it_behaves_like 'transactions'
  it_behaves_like 'sorted sets'
  it_behaves_like 'upcase method names'
end

describe 'Rediska' do
  subject { Redis.new }

  before do
    Rediska.configure do |config|
      config.namespace = 'rediska_test'
    end
  end

  context 'fake redis' do
    context 'memory' do
      before do
        subject.flushall
        subject.discard rescue nil
      end

      it_behaves_like 'redis'
    end

    context 'PStore' do
      before do
        Rediska.configure do |config|
          config.database = :filesystem
        end

        subject.flushall
        subject.discard rescue nil
      end

      it_behaves_like 'redis'
    end
  end

  pending 'real redis (interoperability)' do
    before do
      subject.flushall
      subject.discard rescue nil
    end

    before(:all) do
      Redis::Connection.drivers.pop
    end

    after(:all) do
      Redis::Connection.drivers << Rediska::Connection
    end

    it_behaves_like 'redis'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rediska-0.1.1 spec/redis_spec.rb
rediska-0.1.0 spec/redis_spec.rb