lib/split/user.rb in split-1.6.0 vs lib/split/user.rb in split-1.7.0

- old
+ new

@@ -17,11 +17,17 @@ end end end def max_experiments_reached?(experiment_key) - !Split.configuration.allow_multiple_experiments && - keys_without_experiment(user.keys, experiment_key).length > 0 + if Split.configuration.allow_multiple_experiments == 'control' + experiments = active_experiments + count_control = experiments.values.count {|v| v == 'control'} + experiments.size > count_control + else + !Split.configuration.allow_multiple_experiments && + keys_without_experiment(user.keys, experiment_key).length > 0 + end end def cleanup_old_versions!(experiment) keys = user.keys.select { |k| k.match(Regexp.new(experiment.name)) } keys_without_experiment(keys, experiment.key).each { |key| user.delete(key) }