Sha256: 9f56011228544925120a009bf620a8d0035827224747dcb135093bbf8be0e634

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

require 'helper'
require 'flipper/spec/shared_adapter_specs'

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

  it_should_behave_like 'a flipper adapter'

  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)

    expect(source).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

8 entries across 8 versions & 1 rubygems

Version Path
flipper-0.22.2 spec/flipper/adapters/memory_spec.rb
flipper-0.22.1 spec/flipper/adapters/memory_spec.rb
flipper-0.22.0 spec/flipper/adapters/memory_spec.rb
flipper-0.21.0 spec/flipper/adapters/memory_spec.rb
flipper-0.21.0.rc2 spec/flipper/adapters/memory_spec.rb
flipper-0.21.0.rc1 spec/flipper/adapters/memory_spec.rb
flipper-0.20.4 spec/flipper/adapters/memory_spec.rb
flipper-0.20.3 spec/flipper/adapters/memory_spec.rb