Skip to content

Commit

Permalink
Merge pull request #372 from mtyeh411/GH-1066
Browse files Browse the repository at this point in the history
respect manual start configuration  after an experiment has been deleted
  • Loading branch information
andrew committed Apr 21, 2016
2 parents d3a499e + f1ae189 commit b547253
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ It is not required to send `SPLIT_DISABLE=false` to activate Split.
By default new AB tests will be active right after deployment. In case you would like to start new test a while after
the deploy, you can do it by setting the `start_manually` configuration option to `true`.

After choosing this option tests won't be started right after deploy, but after pressing the `Start` button in Split admin dashboard.
After choosing this option tests won't be started right after deploy, but after pressing the `Start` button in Split admin dashboard. If a test is deleted from the Split dashboard, then it can only be started after pressing the `Start` button whenever being re-initialized.

### Reset after completion

Expand Down
3 changes: 3 additions & 0 deletions lib/split/experiment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ def reset

def delete
Split.configuration.on_before_experiment_delete.call(self)
if Split.configuration.start_manually
Split.redis.hdel(:experiment_start_times, @name)
end
alternatives.each(&:delete)
reset_winner
Split.redis.srem(:experiments, name)
Expand Down
7 changes: 7 additions & 0 deletions spec/experiment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,13 @@ def alternative(color)
expect(Split.configuration.on_before_experiment_delete).to receive(:call)
experiment.delete
end

it 'should reset the start time if the experiment should be manually started' do
Split.configuration.start_manually = true
experiment.start
experiment.delete
expect(experiment.start_time).to be_nil
end
end


Expand Down

0 comments on commit b547253

Please sign in to comment.