Sha256: 743f785bcf34670fad2462ac008f57e0005297ee26662c00591af10e60067c40

Contents?: true

Size: 693 Bytes

Versions: 3

Compression:

Stored size: 693 Bytes

Contents

require 'helper'
require 'flipper/adapters/redis'
require 'flipper/spec/shared_adapter_specs'

describe Flipper::Adapters::Redis do
  let(:client) { Redis.new }

  subject { Flipper::Adapters::Redis.new(client) }

  before do
    client.flushdb
  end

  def read_key(key)
    client.get key
  rescue RuntimeError => e
    if e.message =~ /wrong kind of value/
      client.smembers(key).map { |member| member.to_i }.to_set
    else
      raise
    end
  end

  def write_key(key, value)
    case value
    when Array, Set
      value.each do |member|
        client.sadd key, member
      end
    else
      client.set key, value
    end
  end

  it_should_behave_like 'a flipper adapter'
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
flipper-redis-0.2.0 spec/flipper/redis_spec.rb
flipper-redis-0.1.1 spec/flipper/redis_spec.rb
flipper-redis-0.1.0 spec/flipper/redis_spec.rb