split 1.6.0 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60d1a66ab97c5078436d0d296fc25ad34922ef38
4
- data.tar.gz: 284625b3580739a2e27f6fc9a7995e85102eca73
3
+ metadata.gz: 75e3f5edc1fef8a1131b615f82d5ec12cac72c29
4
+ data.tar.gz: bd21bc8f80816d06b3e05532152525e81c54e018
5
5
  SHA512:
6
- metadata.gz: a0c68d144101879fb891a5be0bdeeab33b09279e04254fb64d969d83330c93dcbac450e1abb489ddfc06e31cdd891f71f8b24d2198d54eab7e38e3f98212aea3
7
- data.tar.gz: caada44139cec833add6c1f4085d5dc11e5289b3b0571b137bdf52c904d340cdc06f985944bee402dfaebed6cfa4f3283c75fd882dd12e929ab49952465d8f35
6
+ metadata.gz: 6c3dc4cf24791918469b0c7677b63ea04510ff216c3cb46de2fffe82ebb77110d8ec94269dff6ee32fe20c49ff256c9dee304b07933116166ba91746ca486737
7
+ data.tar.gz: 51b7bceb61bb92b61abd0b35eae3f5b142f6e1b48341a4a9d1753a4853289fc998e1a60dc462c3b8bac53c71f231b050952ab3f89a69d175ec32e78f0e7f3e97
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.7.0 (June 28th, 2016)
2
+
3
+ Features:
4
+
5
+ - Running concurrent experiments on same endpoint/view (@karmakaze, #421)
6
+
1
7
  ## 1.6.0 (June 16th, 2016)
2
8
 
3
9
  Features:
data/README.md CHANGED
@@ -171,7 +171,7 @@ Any old unfinished experiment key will be deleted from the user's data storage i
171
171
 
172
172
  By default Split will avoid users participating in multiple experiments at once. This means you are less likely to skew results by adding in more variation to your tests.
173
173
 
174
- To stop this behaviour and allow users to participate in multiple experiments at once enable the `allow_multiple_experiments` config option like so:
174
+ To stop this behaviour and allow users to participate in multiple experiments at once set the `allow_multiple_experiments` config option to true like so:
175
175
 
176
176
  ```ruby
177
177
  Split.configure do |config|
@@ -179,6 +179,17 @@ Split.configure do |config|
179
179
  end
180
180
  ```
181
181
 
182
+ This will allow the user to participate in any number of experiments and belong to any alternative in each experiment. This has the possible downside of a variation in one experiment influencing the outcome of another.
183
+
184
+ To address this, setting the `allow_multiple_experiments` config option to 'control' like so:
185
+ ```ruby
186
+ Split.configure do |config|
187
+ config.allow_multiple_experiments = 'control'
188
+ end
189
+ ```
190
+
191
+ For this to work, each and every experiment you define must have an alternative named 'control'. This will allow the user to participate in multiple experiments as long as the user belongs to the alternative 'control' in each experiment. As soon as the user belongs to an alternative named something other than 'control' the user may not participate in any more experiments. Calling ab_test(<other experiments>) will always return the first alternative without adding the user to that experiment.
192
+
182
193
  ### Experiment Persistence
183
194
 
184
195
  Split comes with three built-in persistence adapters for storing users and the alternatives they've been given for each experiment.
data/lib/split/user.rb CHANGED
@@ -19,8 +19,14 @@ module Split
19
19
  end
20
20
 
21
21
  def max_experiments_reached?(experiment_key)
22
- !Split.configuration.allow_multiple_experiments &&
23
- keys_without_experiment(user.keys, experiment_key).length > 0
22
+ if Split.configuration.allow_multiple_experiments == 'control'
23
+ experiments = active_experiments
24
+ count_control = experiments.values.count {|v| v == 'control'}
25
+ experiments.size > count_control
26
+ else
27
+ !Split.configuration.allow_multiple_experiments &&
28
+ keys_without_experiment(user.keys, experiment_key).length > 0
29
+ end
24
30
  end
25
31
 
26
32
  def cleanup_old_versions!(experiment)
data/lib/split/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module Split
3
3
  MAJOR = 1
4
- MINOR = 6
4
+ MINOR = 7
5
5
  PATCH = 0
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
7
7
  end
data/spec/helper_spec.rb CHANGED
@@ -191,6 +191,26 @@ describe Split::Helper do
191
191
  expect(button_size_alt.participant_count).to eq(1)
192
192
  end
193
193
 
194
+ it "should let a user participate in many experiment with one non-'control' alternative with allow_multiple_experiments = 'control'" do
195
+ Split.configure do |config|
196
+ config.allow_multiple_experiments = 'control'
197
+ end
198
+ groups = []
199
+ (0..100).each do |n|
200
+ alt = ab_test("test#{n}".to_sym, {'control' => (100 - n)}, {'test#{n}-alt' => n})
201
+ groups << alt
202
+ end
203
+
204
+ experiments = ab_user.active_experiments
205
+ expect(experiments.size).to be > 1
206
+
207
+ count_control = experiments.values.count { |g| g == 'control' }
208
+ expect(count_control).to eq(experiments.size - 1)
209
+
210
+ count_alts = groups.count { |g| g != 'control' }
211
+ expect(count_alts).to eq(1)
212
+ end
213
+
194
214
  it "should not over-write a finished key when an experiment is on a later version" do
195
215
  experiment.increment_version
196
216
  ab_user = { experiment.key => 'blue', experiment.finished_key => true }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: split
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-16 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis