Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/split/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def control_variable(control)

def start_trial(trial)
experiment = trial.experiment
if override_present?(experiment.name)
if override_present?(experiment.name) and experiment[override_alternative(experiment.name)]
ret = override_alternative(experiment.name)
ab_user[experiment.key] = ret if Split.configuration.store_override
elsif experiment.has_winner?
Expand Down
6 changes: 6 additions & 0 deletions spec/helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@
alternative.should eql('red')
end

it "should not allow an arbitrary alternative" do
@params = {'link_color' => 'pink'}
alternative = ab_test('link_color', 'blue')
alternative.should eql('blue')
end

it "should not store the split when a param forced alternative" do
@params = {'link_color' => 'blue'}
ab_user.should_not_receive(:[]=)
Expand Down