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 @@ -8,7 +8,7 @@ module Helper
def ab_test(metric_descriptor, control = nil, *alternatives)
begin
experiment = ExperimentCatalog.find_or_initialize(metric_descriptor, control, *alternatives)
alternative = if Split.configuration.enabled
alternative = if Split.configuration.enabled && !exclude_visitor?
experiment.save
raise(Split::InvalidExperimentsFormatError) unless (Split.configuration.experiments || {}).fetch(experiment.name.to_sym, {})[:combined_experiments].nil?
trial = Trial.new(:user => ab_user, :experiment => experiment,
Expand Down
5 changes: 5 additions & 0 deletions spec/helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ def should_finish_experiment(experiment_name, should_finish=true)
expect(alternative).to eq experiment.control.name
end

it 'should not create a experiment' do
ab_test('link_color', 'blue', 'red')
expect(Split::Experiment.new('link_color')).to be_a_new_record
end

it "should not increment the participation count" do

previous_red_count = Split::Alternative.new('red', 'link_color').participant_count
Expand Down