Sha256: 4b67873212e62d9bf26daea794a18a8143a3753340d37dc68a768692e15a98c7

Contents?: true

Size: 1.24 KB

Versions: 15

Compression:

Stored size: 1.24 KB

Contents

RSpec.describe Flipper::Adapters::Memory do
  let(:source) { {} }

  context 'threadsafe: true' do
    subject { described_class.new(source, threadsafe: true) }

    it_should_behave_like 'a flipper adapter'
  end

  context 'threadsafe: false' do
    subject { described_class.new(source, threadsafe: false) }

    it_should_behave_like 'a flipper adapter'
  end

  it "can initialize from big hash" do
    flipper = Flipper.new(subject)
    flipper.enable :subscriptions
    flipper.disable :search
    flipper.enable_percentage_of_actors :pro_deal, 20
    flipper.enable_percentage_of_time :logging, 30
    flipper.enable_actor :following, Flipper::Actor.new('1')
    flipper.enable_actor :following, Flipper::Actor.new('3')
    flipper.enable_group :following, Flipper::Types::Group.new(:staff)

    dup = described_class.new(subject.get_all)

    expect(dup.get_all).to eq({
      "subscriptions" => subject.default_config.merge(boolean: "true"),
      "search" => subject.default_config,
      "logging" => subject.default_config.merge(:percentage_of_time => "30"),
      "pro_deal" => subject.default_config.merge(:percentage_of_actors => "20"),
      "following" => subject.default_config.merge(actors: Set["1", "3"], groups: Set["staff"]),
    })
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
flipper-1.3.2 spec/flipper/adapters/memory_spec.rb
flipper-1.3.1 spec/flipper/adapters/memory_spec.rb
flipper-1.3.0 spec/flipper/adapters/memory_spec.rb
flipper-1.3.0.pre spec/flipper/adapters/memory_spec.rb
flipper-1.2.2 spec/flipper/adapters/memory_spec.rb
flipper-1.2.1 spec/flipper/adapters/memory_spec.rb
flipper-1.2.0 spec/flipper/adapters/memory_spec.rb
flipper-1.1.2 spec/flipper/adapters/memory_spec.rb
flipper-1.1.1 spec/flipper/adapters/memory_spec.rb
flipper-1.1.0 spec/flipper/adapters/memory_spec.rb
flipper-1.0.0 spec/flipper/adapters/memory_spec.rb
flipper-1.0.0.pre spec/flipper/adapters/memory_spec.rb
flipper-0.28.3 spec/flipper/adapters/memory_spec.rb
flipper-0.28.2 spec/flipper/adapters/memory_spec.rb
flipper-0.28.1 spec/flipper/adapters/memory_spec.rb