spec/rollout_spec.rb in rollout-2.2.4 vs spec/rollout_spec.rb in rollout-2.3.0
- old
+ new
@@ -225,30 +225,40 @@
before do
@rollout.activate_percentage(:chat, 20)
end
it "activates the feature for that percentage of the users" do
- expect((1..120).select { |id| @rollout.active?(:chat, double(id: id)) }.length).to be_within(1).of(20)
+ expect((1..100).select { |id| @rollout.active?(:chat, double(id: id)) }.length).to be_within(2).of(20)
end
end
describe "activating a feature for a percentage of users" do
before do
@rollout.activate_percentage(:chat, 20)
end
it "activates the feature for that percentage of the users" do
- expect((1..200).select { |id| @rollout.active?(:chat, double(id: id)) }.length).to be_within(5).of(40)
+ expect((1..200).select { |id| @rollout.active?(:chat, double(id: id)) }.length).to be_within(4).of(40)
end
end
describe "activating a feature for a percentage of users" do
before do
@rollout.activate_percentage(:chat, 5)
end
it "activates the feature for that percentage of the users" do
expect((1..100).select { |id| @rollout.active?(:chat, double(id: id)) }.length).to be_within(2).of(5)
+ end
+ end
+
+ describe "activating a feature for a percentage of users" do
+ before do
+ @rollout.activate_percentage(:chat, 0.1)
+ end
+
+ it "activates the feature for that percentage of the users" do
+ expect((1..10_000).to_set.select { |id| @rollout.active?(:chat, double(id: id)) }.length).to be_within(2).of(10)
end
end
describe "activating a feature for a percentage of users" do
before do