split 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml CHANGED
@@ -2,18 +2,19 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0
5
- - 2.1
6
- - 2.2.0
5
+ - 2.1.10
7
6
  - 2.2.2
8
- - 2.4.3
9
- - 2.5.1
7
+ - 2.3.8
8
+ - 2.4.9
9
+ - 2.5.7
10
+ - 2.6.5
10
11
 
11
12
  gemfile:
12
13
  - gemfiles/4.2.gemfile
13
14
  - gemfiles/5.0.gemfile
14
15
  - gemfiles/5.1.gemfile
15
16
  - gemfiles/5.2.gemfile
16
-
17
+ - gemfiles/6.0.gemfile
17
18
 
18
19
  matrix:
19
20
  exclude:
@@ -21,30 +22,36 @@ matrix:
21
22
  gemfile: gemfiles/5.0.gemfile
22
23
  - rvm: 1.9.3
23
24
  gemfile: gemfiles/5.1.gemfile
25
+ - rvm: 1.9.3
26
+ gemfile: gemfiles/5.2.gemfile
27
+ - rvm: 1.9.3
28
+ gemfile: gemfiles/6.0.gemfile
24
29
  - rvm: 2.0
25
30
  gemfile: gemfiles/5.0.gemfile
26
31
  - rvm: 2.0
27
32
  gemfile: gemfiles/5.1.gemfile
28
- - rvm: 2.1
29
- gemfile: gemfiles/5.0.gemfile
30
- - rvm: 2.1
31
- gemfile: gemfiles/5.1.gemfile
32
- - rvm: 2.2.0
33
- gemfile: gemfiles/5.0.gemfile
34
- - rvm: 2.2.0
35
- gemfile: gemfiles/5.1.gemfile
36
- - rvm: 1.9.3
37
- gemfile: gemfiles/5.2.gemfile
38
33
  - rvm: 2.0
39
34
  gemfile: gemfiles/5.2.gemfile
40
- - rvm: 2.1
41
- gemfile: gemfiles/5.2.gemfile
42
- - rvm: 2.2.0
35
+ - rvm: 2.0
36
+ gemfile: gemfiles/6.0.gemfile
37
+ - rvm: 2.1.10
38
+ gemfile: gemfiles/5.0.gemfile
39
+ - rvm: 2.1.10
40
+ gemfile: gemfiles/5.1.gemfile
41
+ - rvm: 2.1.10
43
42
  gemfile: gemfiles/5.2.gemfile
44
-
43
+ - rvm: 2.1.10
44
+ gemfile: gemfiles/6.0.gemfile
45
+ - rvm: 2.2.2
46
+ gemfile: gemfiles/6.0.gemfile
47
+ - rvm: 2.3.8
48
+ gemfile: gemfiles/6.0.gemfile
49
+ - rvm: 2.4.9
50
+ gemfile: gemfiles/6.0.gemfile
45
51
 
46
52
  before_install:
47
- - gem update --system && gem install bundler
53
+ - gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
54
+ - gem install bundler --version=1.17.3
48
55
 
49
56
  script:
50
57
  - RAILS_ENV=test bundle exec rake spec && bundle exec codeclimate-test-reporter
data/Appraisals CHANGED
@@ -13,3 +13,7 @@ end
13
13
  appraise "5.2" do
14
14
  gem "rails", "~> 5.2"
15
15
  end
16
+
17
+ appraise "6.0" do
18
+ gem 'rails', '~> 6.0'
19
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,78 @@
1
+ ## 3.4.0 (November 9th, 2019)
2
+
3
+ Features:
4
+ - Improve DualAdapter (@santib, #588), adds a new configuration for the DualAdapter, making it possible to keep consistency for logged_out/logged_in users. It's a opt-in flag. No Behavior was changed on this release.
5
+ - Make dashboard pagination default "per" param configurable (@alopatin, #597)
6
+
7
+ Bugfixes:
8
+ - Fix `force_alternative` for experiments with incremented version (@giraffate, #568)
9
+ - Persist alternative weights (@giraffate, #570)
10
+ - Combined experiment performance improvements (@gnanou, #575)
11
+ - Handle correctly case when ab_finished is called before ab_test for a user (@gnanou, #577)
12
+ - When loading active_experiments, it should not look into user's 'finished' keys (@andrehjr, #582)
13
+
14
+ Misc:
15
+ - Remove `rubyforge_project` from gemspec (@giraffate, #583)
16
+ - Fix URLs to replace http with https (@giraffate , #584)
17
+ - Lazily include split helpers in ActionController::Base (@hasghari, #586)
18
+ - Fix unused variable warnings (@andrehjr, #592)
19
+ - Fix ruby warnings (@andrehjr, #593)
20
+ - Update rubocop.yml config (@andrehjr, #594)
21
+ - Add frozen_string_literal to all files that were missing it (@andrehjr, #595)
22
+
23
+ ## 3.3.2 (April 12th, 2019)
24
+
25
+ Features:
26
+ - Added uptime robot to configuration.rb (@razel1982, #556)
27
+ - Check to see if being run in Rails application and run in before_initialize (@husteadrobert, #555)
28
+
29
+ Bugfixes:
30
+ - Fix error message interpolation (@hanibash, #553)
31
+ - Fix Bigdecimal warnings (@agraves, #551)
32
+ - Avoid hitting up on redis for robots/excluded users. (@andrehjr, #544)
33
+ - Checks for defined?(request) on Helper#exclude_visitor?. (@andrehjr)
34
+
35
+ Misc:
36
+ - Update travis to add Rails 6 (@edmilton, #559)
37
+ - Fix broken specs in developement environment (@dougpetronilio, #557)
38
+
39
+ ## 3.3.1 (January 11th, 2019)
40
+
41
+ Features:
42
+ - Filter some more bots (@janosch-x, #542)
43
+
44
+ Bugfixes:
45
+ - Fix Dashboard Pagination Helper typo (@cattekin, #541)
46
+ - Do not storage alternative in cookie if experiment has a winner (@sadhu89, #539)
47
+ - fix user participating alternative not found (@NaturalHokke, #536)
48
+
49
+ Misc:
50
+ - Tweak RSpec instructions (@eliotsykes, #540)
51
+ - Improve README regarding rspec usage (@vermaxik, #538)
52
+
53
+ ## 3.3.0 (August 13th, 2018)
54
+
55
+ Features:
56
+
57
+ - Added pagination for dashboard (@GeorgeGorbanev, #518)
58
+ - Add Facebot crawler to list of bots (@pfeiffer, #530)
59
+ - Ignore previewing requests (@pfeiffer, #531)
60
+ - Fix binding of ignore_filter (@pfeiffer, #533)
61
+
62
+ Bugfixes:
63
+
64
+ - Fix cookie header duplication (@andrehjr, #522)
65
+
66
+ Performance:
67
+
68
+ - Improve performance of RedisInterface#make_list_length by using LTRIM command (@mlovic, #509)
69
+
70
+ Misc:
71
+
72
+ - Update development dependencies
73
+ - test rails 5.2 on travis (@lostapathy, #524)
74
+ - update ruby versions for travis (@lostapathy, #525)
75
+
1
76
  ## 3.2.0 (September 21st, 2017)
2
77
 
3
78
  Features:
data/CODE_OF_CONDUCT.md CHANGED
@@ -68,7 +68,7 @@ members of the project's leadership.
68
68
  ## Attribution
69
69
 
70
70
  This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
71
+ available at [https://contributor-covenant.org/version/1/4][version]
72
72
 
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
73
+ [homepage]: https://contributor-covenant.org
74
+ [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  source "https://rubygems.org"
2
3
 
3
4
  gemspec
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # [Split](http://libraries.io/rubygems/split)
1
+ # [Split](https://libraries.io/rubygems/split)
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/split.svg)](http://badge.fury.io/rb/split)
4
- [![Build Status](https://secure.travis-ci.org/splitrb/split.svg?branch=master)](http://travis-ci.org/splitrb/split)
4
+ [![Build Status](https://secure.travis-ci.org/splitrb/split.svg?branch=master)](https://travis-ci.org/splitrb/split)
5
5
  [![Code Climate](https://codeclimate.com/github/splitrb/split/badges/gpa.svg)](https://codeclimate.com/github/splitrb/split)
6
6
  [![Test Coverage](https://codeclimate.com/github/splitrb/split/badges/coverage.svg)](https://codeclimate.com/github/splitrb/split/coverage)
7
7
  [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
8
8
  [![Open Source Helpers](https://www.codetriage.com/splitrb/split/badges/users.svg)](https://www.codetriage.com/splitrb/split)
9
9
 
10
- > 📈 The Rack Based A/B testing framework http://libraries.io/rubygems/split
10
+ > 📈 The Rack Based A/B testing framework https://libraries.io/rubygems/split
11
11
 
12
12
  Split is a rack based A/B testing framework designed to work with Rails, Sinatra or any other rack based app.
13
13
 
@@ -110,9 +110,9 @@ Split has two options for you to use to determine which alternative is the best.
110
110
 
111
111
  The first option (default on the dashboard) uses a z test (n>30) for the difference between your control and alternative conversion rates to calculate statistical significance. This test will tell you whether an alternative is better or worse than your control, but it will not distinguish between which alternative is the best in an experiment with multiple alternatives. Split will only tell you if your experiment is 90%, 95%, or 99% significant, and this test only works if you have more than 30 participants and 5 conversions for each branch.
112
112
 
113
- As per this [blog post](http://www.evanmiller.org/how-not-to-run-an-ab-test.html) on the pitfalls of A/B testing, it is highly recommended that you determine your requisite sample size for each branch before running the experiment. Otherwise, you'll have an increased rate of false positives (experiments which show a significant effect where really there is none).
113
+ As per this [blog post](https://www.evanmiller.org/how-not-to-run-an-ab-test.html) on the pitfalls of A/B testing, it is highly recommended that you determine your requisite sample size for each branch before running the experiment. Otherwise, you'll have an increased rate of false positives (experiments which show a significant effect where really there is none).
114
114
 
115
- [Here](http://www.evanmiller.org/ab-testing/sample-size.html) is a sample size calculator for your convenience.
115
+ [Here](https://www.evanmiller.org/ab-testing/sample-size.html) is a sample size calculator for your convenience.
116
116
 
117
117
  The second option uses simulations from a beta distribution to determine the probability that the given alternative is the winner compared to all other alternatives. You can view these probabilities by clicking on the drop-down menu labeled "Confidence." This option should be used when the experiment has more than just 1 control and 1 alternative. It can also be used for a simple, 2-alternative A/B test.
118
118
 
@@ -159,15 +159,15 @@ In the event you want to disable all tests without having to know the individual
159
159
 
160
160
  It is not required to send `SPLIT_DISABLE=false` to activate Split.
161
161
 
162
- To aid testing with RSpec, write `split_helper.rb` and call `use_ab_test(alternatives_by_experiment)` in your specs as instructed below:
162
+
163
+ ### Rspec Helper
164
+ To aid testing with RSpec, write `spec/support/split_helper.rb` and call `use_ab_test(alternatives_by_experiment)` in your specs as instructed below:
163
165
 
164
166
  ```ruby
165
- # Recommended path for this file is 'spec/support/split_helper.rb', and you will need to ensure it
166
- # is `require`-d by rails_helper.rb or spec_helper.rb
167
+ # Create a file with these contents at 'spec/support/split_helper.rb'
168
+ # and ensure it is `require`d in your rails_helper.rb or spec_helper.rb
167
169
  module SplitHelper
168
170
 
169
- # Usage:
170
- #
171
171
  # Force a specific experiment alternative to always be returned:
172
172
  # use_ab_test(signup_form: "single_page")
173
173
  #
@@ -176,18 +176,26 @@ module SplitHelper
176
176
  #
177
177
  def use_ab_test(alternatives_by_experiment)
178
178
  allow_any_instance_of(Split::Helper).to receive(:ab_test) do |_receiver, experiment|
179
- alternative =
180
- alternatives_by_experiment.fetch(experiment) { |key| raise "Unknown experiment '#{key}'" }
179
+ alternatives_by_experiment.fetch(experiment) { |key| raise "Unknown experiment '#{key}'" }
181
180
  end
182
181
  end
183
182
  end
184
183
 
184
+ # Make the `use_ab_test` method available to all specs:
185
185
  RSpec.configure do |config|
186
- # Make the `use_ab_test` method available to all specs:
187
186
  config.include SplitHelper
188
187
  end
189
188
  ```
190
189
 
190
+ Now you can call `use_ab_test(alternatives_by_experiment)` in your specs, for example:
191
+ ```ruby
192
+ it "registers using experimental signup" do
193
+ use_ab_test experiment_name: "alternative_name"
194
+ post "/signups"
195
+ ...
196
+ end
197
+ ```
198
+
191
199
 
192
200
  ### Starting experiments manually
193
201
 
@@ -210,6 +218,12 @@ The user will then always see the alternative they started with.
210
218
 
211
219
  Any old unfinished experiment key will be deleted from the user's data storage if the experiment had been removed or is over and a winner had been chosen. This allows a user to enroll into any new experiment in cases when the `allow_multiple_experiments` config option is set to `false`.
212
220
 
221
+ ### Reset experiments manually
222
+
223
+ By default Split automatically resets the experiment whenever it detects the configuration for an experiment has changed (e.g. you call `ab_test` with different alternatives). You can prevent this by setting the option `reset_manually` to `true`.
224
+
225
+ You may want to do this when you want to change something, like the variants' names, the metadata about an experiment, etc. without resetting everything.
226
+
213
227
  ### Multiple experiments at once
214
228
 
215
229
  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.
@@ -346,7 +360,7 @@ end
346
360
 
347
361
  If you are running `ab_test` from a view, you must define your event
348
362
  hook callback as a
349
- [helper_method](http://apidock.com/rails/AbstractController/Helpers/ClassMethods/helper_method)
363
+ [helper_method](https://apidock.com/rails/AbstractController/Helpers/ClassMethods/helper_method)
350
364
  in the controller:
351
365
 
352
366
  ``` ruby
@@ -432,7 +446,7 @@ match "/split" => Split::Dashboard, anchor: false, via: [:get, :post, :delete],
432
446
  end
433
447
  ```
434
448
 
435
- More information on this [here](http://steve.dynedge.co.uk/2011/12/09/controlling-access-to-routes-and-rack-apps-in-rails-3-with-devise-and-warden/)
449
+ More information on this [here](https://steve.dynedge.co.uk/2011/12/09/controlling-access-to-routes-and-rack-apps-in-rails-3-with-devise-and-warden/)
436
450
 
437
451
  ### Screenshot
438
452
 
@@ -450,6 +464,7 @@ Split.configure do |config|
450
464
  config.enabled = true
451
465
  config.persistence = Split::Persistence::SessionAdapter
452
466
  #config.start_manually = false ## new test will have to be started manually from the admin panel. default false
467
+ #config.reset_manually = false ## if true, it never resets the experiment data, even if the configuration changes
453
468
  config.include_rails_helper = true
454
469
  config.redis = "redis://custom.redis.url:6380"
455
470
  end
@@ -541,7 +556,7 @@ and:
541
556
  ab_finished(:my_first_experiment)
542
557
  ```
543
558
 
544
- You can also add meta data for each experiment, very useful when you need more than an alternative name to change behaviour:
559
+ You can also add meta data for each experiment, which is very useful when you need more than an alternative name to change behaviour:
545
560
 
546
561
  ```ruby
547
562
  Split.configure do |config|
@@ -586,6 +601,8 @@ or in views:
586
601
  <% end %>
587
602
  ```
588
603
 
604
+ The keys used in meta data should be Strings
605
+
589
606
  #### Metrics
590
607
 
591
608
  You might wish to track generic metrics, such as conversions, and use
@@ -809,8 +826,8 @@ end
809
826
 
810
827
  ## Extensions
811
828
 
812
- - [Split::Export](http://github.com/splitrb/split-export) - Easily export A/B test data out of Split.
813
- - [Split::Analytics](http://github.com/splitrb/split-analytics) - Push test data to Google Analytics.
829
+ - [Split::Export](https://github.com/splitrb/split-export) - Easily export A/B test data out of Split.
830
+ - [Split::Analytics](https://github.com/splitrb/split-analytics) - Push test data to Google Analytics.
814
831
  - [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - Store experiment data in mongoid (still uses redis).
815
832
  - [Split::Cacheable](https://github.com/harrystech/split_cacheable) - Automatically create cache buckets per test.
816
833
  - [Split::Counters](https://github.com/bernardkroes/split-counters) - Add counters per experiment and alternative.
@@ -822,7 +839,7 @@ Ryan bates has produced an excellent 10 minute screencast about split on the Rai
822
839
 
823
840
  ## Blogposts
824
841
 
825
- * [Recipe: A/B testing with KISSMetrics and the split gem](http://robots.thoughtbot.com/post/9595887299/recipe-a-b-testing-with-kissmetrics-and-the-split-gem)
842
+ * [Recipe: A/B testing with KISSMetrics and the split gem](https://robots.thoughtbot.com/post/9595887299/recipe-a-b-testing-with-kissmetrics-and-the-split-gem)
826
843
  * [Rails A/B testing with Split on Heroku](http://blog.nathanhumbert.com/2012/02/rails-ab-testing-with-split-on-heroku.html)
827
844
 
828
845
  ## Backers
@@ -902,9 +919,9 @@ Please do! Over 70 different people have contributed to the project, you can see
902
919
 
903
920
  ### Development
904
921
 
905
- The source code is hosted at [GitHub](http://github.com/splitrb/split).
922
+ The source code is hosted at [GitHub](https://github.com/splitrb/split).
906
923
 
907
- Report issues and feature requests on [GitHub Issues](http://github.com/splitrb/split/issues).
924
+ Report issues and feature requests on [GitHub Issues](https://github.com/splitrb/split/issues).
908
925
 
909
926
  You can find a discussion form on [Google Groups](https://groups.google.com/d/forum/split-ruby).
910
927
 
@@ -935,4 +952,4 @@ Please note that this project is released with a [Contributor Code of Conduct](C
935
952
 
936
953
  ## Copyright
937
954
 
938
- [MIT License](LICENSE) © 2018 [Andrew Nesbitt](https://github.com/andrew).
955
+ [MIT License](LICENSE) © 2019 [Andrew Nesbitt](https://github.com/andrew).
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env rake
2
+ # frozen_string_literal: true
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rspec/core/rake_task'
4
5
  require 'appraisal'
@@ -0,0 +1,9 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "appraisal"
6
+ gem "codeclimate-test-reporter"
7
+ gem "rails", "~> 6.0"
8
+
9
+ gemspec path: "../"
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  # Selects alternative with minimum count of participants
2
3
  # If all counts are even (i.e. all are minimum), samples from all possible alternatives
3
4
 
@@ -15,7 +15,7 @@ module Split
15
15
  @name = name
16
16
  @weight = 1
17
17
  end
18
- p_winner = 0.0
18
+ @p_winner = 0.0
19
19
  end
20
20
 
21
21
  def to_s
@@ -75,7 +75,7 @@ module Split
75
75
  return field
76
76
  end
77
77
 
78
- def set_completed_count (count, goal = nil)
78
+ def set_completed_count(count, goal = nil)
79
79
  field = set_field(goal)
80
80
  Split.redis.hset(key, field, count.to_i)
81
81
  end
@@ -122,7 +122,7 @@ module Split
122
122
  # can't calculate zscore for P(x) > 1
123
123
  return 'N/A' if p_a > 1 || p_c > 1
124
124
 
125
- z_score = Split::Zscore.calculate(p_a, n_a, p_c, n_c)
125
+ Split::Zscore.calculate(p_a, n_a, p_c, n_c)
126
126
  end
127
127
 
128
128
  def extra_info
@@ -3,7 +3,7 @@ module Split
3
3
  module CombinedExperimentsHelper
4
4
  def ab_combined_test(metric_descriptor, control = nil, *alternatives)
5
5
  return nil unless experiment = find_combined_experiment(metric_descriptor)
6
- raise(Split::InvalidExperimentsFormatError, 'Unable to find experiment #{metric_descriptor} in configuration') if experiment[:combined_experiments].nil?
6
+ raise(Split::InvalidExperimentsFormatError, "Unable to find experiment #{metric_descriptor} in configuration") if experiment[:combined_experiments].nil?
7
7
 
8
8
  alternative = nil
9
9
  weighted_alternatives = nil
@@ -31,7 +31,7 @@ module Split
31
31
  raise(Split::InvalidExperimentsFormatError, 'Invalid descriptor class (String or Symbol required)') unless metric_descriptor.class == String || metric_descriptor.class == Symbol
32
32
  raise(Split::InvalidExperimentsFormatError, 'Enable configuration') unless Split.configuration.enabled
33
33
  raise(Split::InvalidExperimentsFormatError, 'Enable `allow_multiple_experiments`') unless Split.configuration.allow_multiple_experiments
34
- experiment = Split::configuration.experiments[metric_descriptor.to_sym]
34
+ Split::configuration.experiments[metric_descriptor.to_sym]
35
35
  end
36
36
  end
37
37
  end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Split
3
3
  class Configuration
4
- attr_accessor :bots
5
- attr_accessor :robot_regex
6
4
  attr_accessor :ignore_ip_addresses
7
5
  attr_accessor :ignore_filter
8
6
  attr_accessor :db_failover
@@ -27,9 +25,13 @@ module Split
27
25
  attr_accessor :beta_probability_simulations
28
26
  attr_accessor :winning_alternative_recalculation_interval
29
27
  attr_accessor :redis
28
+ attr_accessor :dashboard_pagination_default_per_page
30
29
 
31
30
  attr_reader :experiments
32
31
 
32
+ attr_writer :bots
33
+ attr_writer :robot_regex
34
+
33
35
  def bots
34
36
  @bots ||= {
35
37
  # Indexers
@@ -61,12 +63,14 @@ module Split
61
63
  'ColdFusion' => 'ColdFusion http library',
62
64
  'EventMachine HttpClient' => 'Ruby http library',
63
65
  'Go http package' => 'Go http library',
66
+ 'Go-http-client' => 'Go http library',
64
67
  'Java' => 'Generic Java http library',
65
68
  'libwww-perl' => 'Perl client-server library loved by script kids',
66
69
  'lwp-trivial' => 'Another Perl library loved by script kids',
67
70
  'Python-urllib' => 'Python http library',
68
71
  'PycURL' => 'Python http library',
69
72
  'Test Certificate Info' => 'C http library?',
73
+ 'Typhoeus' => 'Ruby http library',
70
74
  'Wget' => 'wget unix CLI http client',
71
75
 
72
76
  # URL expanders / previewers
@@ -91,10 +95,12 @@ module Split
91
95
 
92
96
  # Uptime monitoring
93
97
  'check_http' => 'Nagios monitor',
98
+ 'GoogleStackdriverMonitoring' => 'Google Cloud monitor',
94
99
  'NewRelicPinger' => 'NewRelic monitor',
95
100
  'Panopta' => 'Monitoring service',
96
101
  'Pingdom' => 'Pingdom monitoring',
97
102
  'SiteUptime' => 'Site monitoring services',
103
+ 'UptimeRobot' => 'Monitoring service',
98
104
 
99
105
  # ???
100
106
  'DigitalPersona Fingerprint Software' => 'HP Fingerprint scanner',
@@ -221,6 +227,7 @@ module Split
221
227
  @beta_probability_simulations = 10000
222
228
  @winning_alternative_recalculation_interval = 60 * 60 * 24 # 1 day
223
229
  @redis = ENV.fetch(ENV.fetch('REDIS_PROVIDER', 'REDIS_URL'), 'redis://localhost:6379')
230
+ @dashboard_pagination_default_per_page = 10
224
231
  end
225
232
 
226
233
  def redis_url=(value)
@@ -19,9 +19,9 @@ module Split
19
19
 
20
20
  def round(number, precision = 2)
21
21
  begin
22
- BigDecimal.new(number.to_s)
22
+ BigDecimal(number.to_s)
23
23
  rescue ArgumentError
24
- BigDecimal.new(0)
24
+ BigDecimal(0)
25
25
  end.round(precision).to_f
26
26
  end
27
27
 
@@ -3,10 +3,9 @@ require 'split/dashboard/paginator'
3
3
 
4
4
  module Split
5
5
  module DashboardPaginationHelpers
6
- DEFAULT_PER = 10
7
-
8
6
  def pagination_per
9
- @pagination_per ||= (params[:per] || DEFAULT_PER).to_i
7
+ default_per_page = Split.configuration.dashboard_pagination_default_per_page
8
+ @pagination_per ||= (params[:per] || default_per_page).to_i
10
9
  end
11
10
 
12
11
  def page_number
@@ -25,7 +24,7 @@ module Split
25
24
  html << current_page_tag
26
25
  html << next_page_tag if show_next_page_tag?(collection)
27
26
  html << ellipsis_tag if show_last_ellipsis_tag?(collection)
28
- html << last_page_tagcollection if show_last_page_tag?(collection)
27
+ html << last_page_tag(collection) if show_last_page_tag?(collection)
29
28
  html.join
30
29
  end
31
30
 
@@ -21,7 +21,7 @@
21
21
  </div>
22
22
 
23
23
  <div id="footer">
24
- <p>Powered by <a href="http://github.com/splitrb/split">Split</a> v<%=Split::VERSION %></p>
24
+ <p>Powered by <a href="https://github.com/splitrb/split">Split</a> v<%=Split::VERSION %></p>
25
25
  </div>
26
26
  </body>
27
27
  </html>
@@ -33,7 +33,10 @@ module Split
33
33
  end
34
34
 
35
35
  post '/force_alternative' do
36
- Split::User.new(self)[params[:experiment]] = params[:alternative]
36
+ experiment = Split::ExperimentCatalog.find(params[:experiment])
37
+ alternative = Split::Alternative.new(params[:alternative], experiment.name)
38
+ alternative.increment_participation
39
+ Split::User.new(self)[experiment.key] = alternative.name
37
40
  redirect url('/')
38
41
  end
39
42
 
data/lib/split/engine.rb CHANGED
@@ -3,10 +3,12 @@ module Split
3
3
  class Engine < ::Rails::Engine
4
4
  initializer "split" do |app|
5
5
  if Split.configuration.include_rails_helper
6
- ActionController::Base.send :include, Split::Helper
7
- ActionController::Base.helper Split::Helper
8
- ActionController::Base.send :include, Split::CombinedExperimentsHelper
9
- ActionController::Base.helper Split::CombinedExperimentsHelper
6
+ ActiveSupport.on_load(:action_controller) do
7
+ include Split::Helper
8
+ helper Split::Helper
9
+ include Split::CombinedExperimentsHelper
10
+ helper Split::CombinedExperimentsHelper
11
+ end
10
12
  end
11
13
  end
12
14
  end