Sha256: 8c9e879f45e418991e5e2a4a20592f8a53dd5bd25bdbf86232881b1ea9202956

Contents?: true

Size: 774 Bytes

Versions: 10

Compression:

Stored size: 774 Bytes

Contents

RSpec.describe Flipper::Expressions::PercentageOfActors do
  describe "#call" do
    it "returns true when string in percentage enabled" do
      expect(described_class.call("User;1", 42)).to be(true)
    end

    it "returns true when string in fractional percentage enabled" do
      expect(described_class.call("User;1", 41.687)).to be(true)
    end

    it "returns false when string in percentage enabled" do
      expect(described_class.call("User;1", 0)).to be(false)
    end

    it "changes value based on feature_name so not all actors get all features first" do
      expect(described_class.call("User;1", 70, context: {feature_name: "a"})).to be(true)
      expect(described_class.call("User;1", 70, context: {feature_name: "b"})).to be(false)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
flipper-1.3.2 spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.3.1 spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.3.0 spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.3.0.pre spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.2.2 spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.2.1 spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.2.0 spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.1.2 spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.1.1 spec/flipper/expressions/percentage_of_actors_spec.rb
flipper-1.1.0 spec/flipper/expressions/percentage_of_actors_spec.rb