Skip to content

Commit 96f8883

Browse files
committed
Test that ab_finished skips experiments under an active override
1 parent 72c2db0 commit 96f8883

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

spec/helper_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,25 @@
402402
expect(ab_user.keys).to be_empty
403403
end
404404

405+
context "when an override is present for the experiment" do
406+
it "should not increment the completed counter" do
407+
@params = { "ab_test" => { @experiment_name => @alternative_name } }
408+
409+
expect {
410+
ab_finished(@experiment_name)
411+
}.not_to change { Split::Alternative.new(@alternative_name, @experiment_name).completed_count }
412+
end
413+
414+
it "should not touch the user's participation" do
415+
@params = { "ab_test" => { @experiment_name => @alternative_name } }
416+
417+
ab_finished(@experiment_name)
418+
419+
expect(ab_user[@experiment.key]).to eq(@alternative_name)
420+
expect(ab_user[@experiment.finished_key]).to be_nil
421+
end
422+
end
423+
405424
context "when on_trial_complete is set" do
406425
before { Split.configuration.on_trial_complete = :some_method }
407426
it "should call the method" do

0 commit comments

Comments
 (0)