Sha256: e1c196aafc4af0c461b5300c0342b7c3ca5d38e84e77ac69740dc743439003c8

Contents?: true

Size: 1.04 KB

Versions: 5

Compression:

Stored size: 1.04 KB

Contents

require 'helper'
require 'flipper/configuration'

RSpec.describe Flipper::Configuration do
  describe '#adapter' do
    it 'returns instance using Memory adapter' do
      expect(subject.adapter).to be_a(Flipper::Adapters::Memory)
    end

    it 'can be set' do
      instance = Flipper::Adapters::Memory.new
      expect(subject.adapter).not_to be(instance)
      subject.adapter { instance }
      expect(subject.adapter).to be(instance)
      # All adapters are wrapped in Memoizable
      expect(subject.default.adapter.adapter).to be(instance)
    end
  end

  describe '#default' do
    it 'returns instance using Memory adapter' do
      expect(subject.default).to be_a(Flipper::DSL)
      # All adapters are wrapped in Memoizable
      expect(subject.default.adapter.adapter).to be_a(Flipper::Adapters::Memory)
    end

    it 'can be set default' do
      instance = Flipper.new(Flipper::Adapters::Memory.new)
      expect(subject.default).not_to be(instance)
      subject.default { instance }
      expect(subject.default).to be(instance)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flipper-0.22.2 spec/flipper/configuration_spec.rb
flipper-0.22.1 spec/flipper/configuration_spec.rb
flipper-0.22.0 spec/flipper/configuration_spec.rb
flipper-0.21.0 spec/flipper/configuration_spec.rb
flipper-0.21.0.rc2 spec/flipper/configuration_spec.rb