Sha256: 61d95000bbae3ec109bd3befe0c6f9c4f19e5a93f6fa2582acaefc472f8dc1de

Contents?: true

Size: 879 Bytes

Versions: 5

Compression:

Stored size: 879 Bytes

Contents

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

describe Flipper::Adapters::Fallback do
  context "when redis is available" do
    let(:client) {
      options = {}

      if ENV['BOXEN_REDIS_URL']
        options[:url] = ENV['BOXEN_REDIS_URL']
      end

      Redis.new(options)
    }

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

    before do
      client.flushdb
    end

    it_should_behave_like 'a flipper adapter'
  end

  context "when redis is not available" do
    let(:client) {
      options = {}

      if ENV['BOXEN_REDIS_URL']
        options[:url] = "redis://doesnotexit:1"
      end

      Redis.new(options)
    }

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

    it_should_behave_like 'a flipper adapter'
  end
end

Version data entries

5 entries across 3 versions & 1 rubygems

Version Path
flipper-fallback-0.1.0 fallback_spec.rb
flipper-fallback-0.0.2 fallback_spec.rb
flipper-fallback-0.0.2 spec/fallback_spec.rb
flipper-fallback-0.0.1 fallback_spec.rb
flipper-fallback-0.0.1 spec/fallback_spec.rb