split 3.0.0 → 3.1.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: b0a3a695f8950186c2af7c9fd33b4201f785656a
4
- data.tar.gz: f24adb5a893e0cac0cbf29c06ec86d9ae692c1a2
3
+ metadata.gz: 76d9f44d0d50f07ea46e299f93bbb5bdb1333b8b
4
+ data.tar.gz: 40e88a5a32652b2acbd049562810fb8c8da03da4
5
5
  SHA512:
6
- metadata.gz: 41138ef7911a9843cbc3fa81f78b28184087dacfff4d291d820ae32faf343fce0a9552f4d0123d647751ceadf8c1f242d44bd7e476e50a69165a49b13e422e27
7
- data.tar.gz: c8cfabeb28e143872e7c81f5d3e4dd28f2cb9c8d274f21a31481eaa52725eed06876ef6959ad44aacb84c47f064c84953d2edffd4767951774011037aff28e96
6
+ metadata.gz: c77ff217b8bdf985904c5949b7d401b479e516d6035f1e94ed50aebab5637bf3df9b9d4d22f9aa815a2c8f3a6d54c4cca66a71d4b43aa47c981ffda530a07d8f
7
+ data.tar.gz: 3bcacf988dbe704ca2460e681a1f0531fa1ca47486c4239d6e6db38234226b23186d55787e7bafefc8cfa9aeff12ce0400bbc6b1a83ed6166e89c9fca491711c
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.4.0
3
+ - 2.4.1
4
4
 
5
5
  gemfile:
6
6
  - gemfiles/4.2.gemfile
data/Appraisals CHANGED
@@ -6,3 +6,8 @@ appraise "5.0" do
6
6
  gem "rails", "~> 5.0"
7
7
  gem "sinatra", git: "https://github.com/sinatra/sinatra"
8
8
  end
9
+
10
+ appraise "5.1" do
11
+ gem "rails", "~> 5.1"
12
+ gem "sinatra", git: "https://github.com/sinatra/sinatra"
13
+ end
@@ -1,3 +1,23 @@
1
+ ## 3.1.0 (August 14th, 2017)
2
+
3
+ Features:
4
+
5
+ - Support for combined experiments (@daviddening, #493)
6
+ - Rewrite CookieAdapter to work with Rack::Request and Rack::Response directly (@andrehjr, #490)
7
+ - Enumeration of a User's Experiments that Respects the db_failover Option(@MarkRoddy, #487)
8
+
9
+ Bugfixes:
10
+
11
+ - Blocked a few more common bot user agents (@kylerippey, #485)
12
+
13
+ Misc:
14
+
15
+ - Repository Audit by Maintainer.io (@RichardLitt, #484)
16
+ - Update development dependencies
17
+ - Test on ruby 2.4.1
18
+ - Test compatibility with rails 5.1
19
+ - Add uris to metadata section in gemspec
20
+
1
21
  ## 3.0.0 (March 30th, 2017)
2
22
 
3
23
  Features:
@@ -1,13 +1,62 @@
1
- ## Contributing
1
+ # Contributing to Split
2
2
 
3
- *Note*: Split requires Ruby 1.9.2 or higher.
3
+ Want to contribute to Split? That's great! Here are a couple of guidelines that will help you contribute. Before we get started: Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md) to ensure that this project is a welcoming place for **everyone** to contribute to. By participating in this project you agree to abide by its terms.
4
+
5
+ #### Overview
6
+
7
+ * [Contribution workflow](#contribution-workflow)
8
+ * [Setup instructions](#setup-instructions)
9
+ * [Reporting a bug](#reporting-a-bug)
10
+ * [Contributing to an existing issue](#contributing-to-an-existing-issue)
11
+ * [Our labels](#our-labels)
12
+ * [Additional info](#additional-info)
13
+
14
+ ## Contribution workflow
4
15
 
5
16
  * Fork the project.
6
17
  * Make your feature addition or bug fix.
7
18
  * Add tests for it. This is important so I don't break it in a
8
19
  future version unintentionally.
9
20
  * Add documentation if necessary.
10
- * Commit, do not mess with rakefile, version, or history.
11
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
21
+ * Commit. Do not mess with the Rakefile, version, or history.
22
+ (If you want to have your own version, that is fine. But bump version in a commit by itself I can ignore when I pull.)
12
23
  * Send a pull request. Bonus points for topic branches.
13
- * Discussion at the [Google Group](https://groups.google.com/d/forum/split-ruby)
24
+ * Discussion at the [Google Group](https://groups.google.com/d/forum/split-ruby)
25
+
26
+ ## Setup instructions
27
+
28
+ You can find in-depth instructions to install in our [README](https://github.com/splitrb/split/blob/master/README.md).
29
+
30
+ *Note*: Split requires Ruby 1.9.2 or higher.
31
+
32
+ ## Reporting a bug
33
+
34
+ So you've found a bug, and want to help us fix it? Before filing a bug report, please double-check the bug hasn't already been reported. You can do so [on our issue tracker](https://github.com/splitrb/split/issues?q=is%3Aissue+is%3Aopen+label%3Abug). If something hasn't been raised, you can go ahead and create a new issue with the following information:
35
+
36
+ * When did the error happen?
37
+ * How can the error be reproduced?
38
+ * If possible, please also provide an error message or a screenshot to illustrate the problem.
39
+
40
+ If you want to be really thorough, there is a great overview on Stack Overflow of [what you should consider when reporting a bug](http://stackoverflow.com/questions/240323/how-to-report-bugs-the-smart-way).
41
+
42
+ It goes without saying that you're welcome to help investigate further and/or find a fix for the bug. If you want to do so, just mention it in your bug report and offer your help!
43
+
44
+ ## Contributing to an existing issue
45
+
46
+ ### Finding an issue to work on
47
+
48
+ We've got a few open issues and are always glad to get help on that front. You can view the list of issues [here](https://github.com/splitrb/split/issues). Most of the issues are labelled, so you can use the labels to get an idea of which issue could be a good fit for you. (Here's [a good article](https://medium.freecodecamp.com/finding-your-first-open-source-project-or-bug-to-work-on-1712f651e5ba) on how to find your first bug to fix).
49
+
50
+ Before getting to work, take a look at the issue and at the conversation around it. Has someone already offered to work on the issue? Has someone been assigned to the issue? If so, you might want to check with them to see whether they're still actively working on it.
51
+
52
+ If the issue is a few months old, it might be a good idea to write a short comment to double-check that the issue or feature is still a valid one to jump on.
53
+
54
+ Feel free to ask for more detail on what is expected: are there any more details or specifications you need to know?
55
+
56
+ And if at any point you get stuck: don't hesitate to ask for help.
57
+
58
+ ### Making your contribution
59
+
60
+ We've outlined the contribution workflow [here](#contribution-workflow). If you're a first-timer, don't worry! GitHub has a ton of guides to help you through your first pull request: You can find out more about pull requests [here](https://help.github.com/articles/about-pull-requests/) and about creating a pull request [here](https://help.github.com/articles/creating-a-pull-request/).
61
+
62
+ Especially if you're a newcomer to Open Source and you've found some little bumps along the way while contributing, we recommend you write about them. [Here](https://medium.freecodecamp.com/new-contributors-to-open-source-please-blog-more-920af14cffd)'s a great article about why writing about your experience is important; this will encourage other beginners to try their luck at Open Source, too!
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 Andrew Nesbitt
3
+ Copyright (c) 2017 Andrew Nesbitt
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,97 +1,28 @@
1
- # [Split](http://libraries.io/rubygems/split)
2
-
3
- Split is a rack based ab testing framework designed to work with Rails, Sinatra or any other rack based app.
4
-
5
- Split is heavily inspired by the Abingo and Vanity rails ab testing plugins and Resque in its use of Redis.
6
-
7
- Split is designed to be hacker friendly, allowing for maximum customisation and extensibility.
1
+ # [Split](http://libraries.io/rubygems/split)
8
2
 
9
3
  [![Gem Version](https://badge.fury.io/rb/split.svg)](http://badge.fury.io/rb/split)
10
4
  [![Build Status](https://secure.travis-ci.org/splitrb/split.svg?branch=master)](http://travis-ci.org/splitrb/split)
11
5
  [![Code Climate](https://codeclimate.com/github/splitrb/split/badges/gpa.svg)](https://codeclimate.com/github/splitrb/split)
12
6
  [![Test Coverage](https://codeclimate.com/github/splitrb/split/badges/coverage.svg)](https://codeclimate.com/github/splitrb/split/coverage)
7
+ [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
13
8
 
9
+ > 📈 The Rack Based A/B testing framework http://libraries.io/rubygems/split
14
10
 
15
- # Backers
16
-
17
- Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/split#backer)]
18
-
19
- <a href="https://opencollective.com/split/backer/0/website" target="_blank"><img src="https://opencollective.com/split/backer/0/avatar.svg"></a>
20
- <a href="https://opencollective.com/split/backer/1/website" target="_blank"><img src="https://opencollective.com/split/backer/1/avatar.svg"></a>
21
- <a href="https://opencollective.com/split/backer/2/website" target="_blank"><img src="https://opencollective.com/split/backer/2/avatar.svg"></a>
22
- <a href="https://opencollective.com/split/backer/3/website" target="_blank"><img src="https://opencollective.com/split/backer/3/avatar.svg"></a>
23
- <a href="https://opencollective.com/split/backer/4/website" target="_blank"><img src="https://opencollective.com/split/backer/4/avatar.svg"></a>
24
- <a href="https://opencollective.com/split/backer/5/website" target="_blank"><img src="https://opencollective.com/split/backer/5/avatar.svg"></a>
25
- <a href="https://opencollective.com/split/backer/6/website" target="_blank"><img src="https://opencollective.com/split/backer/6/avatar.svg"></a>
26
- <a href="https://opencollective.com/split/backer/7/website" target="_blank"><img src="https://opencollective.com/split/backer/7/avatar.svg"></a>
27
- <a href="https://opencollective.com/split/backer/8/website" target="_blank"><img src="https://opencollective.com/split/backer/8/avatar.svg"></a>
28
- <a href="https://opencollective.com/split/backer/9/website" target="_blank"><img src="https://opencollective.com/split/backer/9/avatar.svg"></a>
29
- <a href="https://opencollective.com/split/backer/10/website" target="_blank"><img src="https://opencollective.com/split/backer/10/avatar.svg"></a>
30
- <a href="https://opencollective.com/split/backer/11/website" target="_blank"><img src="https://opencollective.com/split/backer/11/avatar.svg"></a>
31
- <a href="https://opencollective.com/split/backer/12/website" target="_blank"><img src="https://opencollective.com/split/backer/12/avatar.svg"></a>
32
- <a href="https://opencollective.com/split/backer/13/website" target="_blank"><img src="https://opencollective.com/split/backer/13/avatar.svg"></a>
33
- <a href="https://opencollective.com/split/backer/14/website" target="_blank"><img src="https://opencollective.com/split/backer/14/avatar.svg"></a>
34
- <a href="https://opencollective.com/split/backer/15/website" target="_blank"><img src="https://opencollective.com/split/backer/15/avatar.svg"></a>
35
- <a href="https://opencollective.com/split/backer/16/website" target="_blank"><img src="https://opencollective.com/split/backer/16/avatar.svg"></a>
36
- <a href="https://opencollective.com/split/backer/17/website" target="_blank"><img src="https://opencollective.com/split/backer/17/avatar.svg"></a>
37
- <a href="https://opencollective.com/split/backer/18/website" target="_blank"><img src="https://opencollective.com/split/backer/18/avatar.svg"></a>
38
- <a href="https://opencollective.com/split/backer/19/website" target="_blank"><img src="https://opencollective.com/split/backer/19/avatar.svg"></a>
39
- <a href="https://opencollective.com/split/backer/20/website" target="_blank"><img src="https://opencollective.com/split/backer/20/avatar.svg"></a>
40
- <a href="https://opencollective.com/split/backer/21/website" target="_blank"><img src="https://opencollective.com/split/backer/21/avatar.svg"></a>
41
- <a href="https://opencollective.com/split/backer/22/website" target="_blank"><img src="https://opencollective.com/split/backer/22/avatar.svg"></a>
42
- <a href="https://opencollective.com/split/backer/23/website" target="_blank"><img src="https://opencollective.com/split/backer/23/avatar.svg"></a>
43
- <a href="https://opencollective.com/split/backer/24/website" target="_blank"><img src="https://opencollective.com/split/backer/24/avatar.svg"></a>
44
- <a href="https://opencollective.com/split/backer/25/website" target="_blank"><img src="https://opencollective.com/split/backer/25/avatar.svg"></a>
45
- <a href="https://opencollective.com/split/backer/26/website" target="_blank"><img src="https://opencollective.com/split/backer/26/avatar.svg"></a>
46
- <a href="https://opencollective.com/split/backer/27/website" target="_blank"><img src="https://opencollective.com/split/backer/27/avatar.svg"></a>
47
- <a href="https://opencollective.com/split/backer/28/website" target="_blank"><img src="https://opencollective.com/split/backer/28/avatar.svg"></a>
48
- <a href="https://opencollective.com/split/backer/29/website" target="_blank"><img src="https://opencollective.com/split/backer/29/avatar.svg"></a>
49
-
50
-
51
- # Sponsors
52
-
53
- Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/split#sponsor)]
11
+ Split is a rack based A/B testing framework designed to work with Rails, Sinatra or any other rack based app.
54
12
 
55
- <a href="https://opencollective.com/split/sponsor/0/website" target="_blank"><img src="https://opencollective.com/split/sponsor/0/avatar.svg"></a>
56
- <a href="https://opencollective.com/split/sponsor/1/website" target="_blank"><img src="https://opencollective.com/split/sponsor/1/avatar.svg"></a>
57
- <a href="https://opencollective.com/split/sponsor/2/website" target="_blank"><img src="https://opencollective.com/split/sponsor/2/avatar.svg"></a>
58
- <a href="https://opencollective.com/split/sponsor/3/website" target="_blank"><img src="https://opencollective.com/split/sponsor/3/avatar.svg"></a>
59
- <a href="https://opencollective.com/split/sponsor/4/website" target="_blank"><img src="https://opencollective.com/split/sponsor/4/avatar.svg"></a>
60
- <a href="https://opencollective.com/split/sponsor/5/website" target="_blank"><img src="https://opencollective.com/split/sponsor/5/avatar.svg"></a>
61
- <a href="https://opencollective.com/split/sponsor/6/website" target="_blank"><img src="https://opencollective.com/split/sponsor/6/avatar.svg"></a>
62
- <a href="https://opencollective.com/split/sponsor/7/website" target="_blank"><img src="https://opencollective.com/split/sponsor/7/avatar.svg"></a>
63
- <a href="https://opencollective.com/split/sponsor/8/website" target="_blank"><img src="https://opencollective.com/split/sponsor/8/avatar.svg"></a>
64
- <a href="https://opencollective.com/split/sponsor/9/website" target="_blank"><img src="https://opencollective.com/split/sponsor/9/avatar.svg"></a>
65
- <a href="https://opencollective.com/split/sponsor/10/website" target="_blank"><img src="https://opencollective.com/split/sponsor/10/avatar.svg"></a>
66
- <a href="https://opencollective.com/split/sponsor/11/website" target="_blank"><img src="https://opencollective.com/split/sponsor/11/avatar.svg"></a>
67
- <a href="https://opencollective.com/split/sponsor/12/website" target="_blank"><img src="https://opencollective.com/split/sponsor/12/avatar.svg"></a>
68
- <a href="https://opencollective.com/split/sponsor/13/website" target="_blank"><img src="https://opencollective.com/split/sponsor/13/avatar.svg"></a>
69
- <a href="https://opencollective.com/split/sponsor/14/website" target="_blank"><img src="https://opencollective.com/split/sponsor/14/avatar.svg"></a>
70
- <a href="https://opencollective.com/split/sponsor/15/website" target="_blank"><img src="https://opencollective.com/split/sponsor/15/avatar.svg"></a>
71
- <a href="https://opencollective.com/split/sponsor/16/website" target="_blank"><img src="https://opencollective.com/split/sponsor/16/avatar.svg"></a>
72
- <a href="https://opencollective.com/split/sponsor/17/website" target="_blank"><img src="https://opencollective.com/split/sponsor/17/avatar.svg"></a>
73
- <a href="https://opencollective.com/split/sponsor/18/website" target="_blank"><img src="https://opencollective.com/split/sponsor/18/avatar.svg"></a>
74
- <a href="https://opencollective.com/split/sponsor/19/website" target="_blank"><img src="https://opencollective.com/split/sponsor/19/avatar.svg"></a>
75
- <a href="https://opencollective.com/split/sponsor/20/website" target="_blank"><img src="https://opencollective.com/split/sponsor/20/avatar.svg"></a>
76
- <a href="https://opencollective.com/split/sponsor/21/website" target="_blank"><img src="https://opencollective.com/split/sponsor/21/avatar.svg"></a>
77
- <a href="https://opencollective.com/split/sponsor/22/website" target="_blank"><img src="https://opencollective.com/split/sponsor/22/avatar.svg"></a>
78
- <a href="https://opencollective.com/split/sponsor/23/website" target="_blank"><img src="https://opencollective.com/split/sponsor/23/avatar.svg"></a>
79
- <a href="https://opencollective.com/split/sponsor/24/website" target="_blank"><img src="https://opencollective.com/split/sponsor/24/avatar.svg"></a>
80
- <a href="https://opencollective.com/split/sponsor/25/website" target="_blank"><img src="https://opencollective.com/split/sponsor/25/avatar.svg"></a>
81
- <a href="https://opencollective.com/split/sponsor/26/website" target="_blank"><img src="https://opencollective.com/split/sponsor/26/avatar.svg"></a>
82
- <a href="https://opencollective.com/split/sponsor/27/website" target="_blank"><img src="https://opencollective.com/split/sponsor/27/avatar.svg"></a>
83
- <a href="https://opencollective.com/split/sponsor/28/website" target="_blank"><img src="https://opencollective.com/split/sponsor/28/avatar.svg"></a>
84
- <a href="https://opencollective.com/split/sponsor/29/website" target="_blank"><img src="https://opencollective.com/split/sponsor/29/avatar.svg"></a>
13
+ Split is heavily inspired by the [Abingo](https://github.com/ryanb/abingo) and [Vanity](https://github.com/assaf/vanity) Rails A/B testing plugins and [Resque](https://github.com/resque/resque) in its use of Redis.
85
14
 
15
+ Split is designed to be hacker friendly, allowing for maximum customisation and extensibility.
86
16
 
17
+ ## Install
87
18
 
88
- ## Requirements
19
+ ### Requirements
89
20
 
90
21
  Split currently requires Ruby 1.9.2 or higher. If your project requires compatibility with Ruby 1.8.x and Rails 2.3, please use v0.8.0.
91
22
 
92
- Split uses redis as a datastore.
23
+ Split uses Redis as a datastore.
93
24
 
94
- Split only supports redis 2.0 or greater.
25
+ Split only supports Redis 2.0 or greater.
95
26
 
96
27
  If you're on OS X, Homebrew is the simplest way to install Redis:
97
28
 
@@ -100,21 +31,21 @@ brew install redis
100
31
  redis-server /usr/local/etc/redis.conf
101
32
  ```
102
33
 
103
- You now have a Redis daemon running on 6379.
34
+ You now have a Redis daemon running on port `6379`.
104
35
 
105
- ## Setup
36
+ ### Setup
106
37
 
107
38
  ```bash
108
39
  gem install split
109
40
  ```
110
41
 
111
- ### Rails
42
+ #### Rails
112
43
 
113
- Adding `gem 'split'` to your Gemfile will autoload it when rails starts up, as long as you've configured redis it will 'just work'.
44
+ Adding `gem 'split'` to your Gemfile will autoload it when rails starts up, as long as you've configured Redis it will 'just work'.
114
45
 
115
- ### Sinatra
46
+ #### Sinatra
116
47
 
117
- To configure sinatra with Split you need to enable sessions and mix in the helper methods. Add the following lines at the top of your sinatra app:
48
+ To configure Sinatra with Split you need to enable sessions and mix in the helper methods. Add the following lines at the top of your Sinatra app:
118
49
 
119
50
  ```ruby
120
51
  require 'split'
@@ -130,7 +61,7 @@ end
130
61
 
131
62
  ## Usage
132
63
 
133
- To begin your ab test use the `ab_test` method, naming your experiment with the first argument and then the different alternatives which you wish to test on as the other arguments.
64
+ To begin your A/B test use the `ab_test` method, naming your experiment with the first argument and then the different alternatives which you wish to test on as the other arguments.
134
65
 
135
66
  `ab_test` returns one of the alternatives, if a user has already seen that test they will get the same alternative as before, which you can use to split your code on.
136
67
 
@@ -184,7 +115,6 @@ As per this [blog post](http://www.evanmiller.org/how-not-to-run-an-ab-test.html
184
115
 
185
116
  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.
186
117
 
187
-
188
118
  ## Extras
189
119
 
190
120
  ### Weighted alternatives
@@ -222,7 +152,7 @@ It is not required to send `SPLIT_DISABLE=false` to activate Split.
222
152
 
223
153
  ### Starting experiments manually
224
154
 
225
- By default new AB tests will be active right after deployment. In case you would like to start new test a while after
155
+ By default new A/B tests will be active right after deployment. In case you would like to start new test a while after
226
156
  the deploy, you can do it by setting the `start_manually` configuration option to `true`.
227
157
 
228
158
  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.
@@ -475,7 +405,7 @@ You can override the default configuration options of Split like so:
475
405
 
476
406
  ```ruby
477
407
  Split.configure do |config|
478
- config.db_failover = true # handle redis errors gracefully
408
+ config.db_failover = true # handle Redis errors gracefully
479
409
  config.db_failover_on_db_error = -> (error) { Rails.logger.error(error.message) }
480
410
  config.allow_multiple_experiments = true
481
411
  config.enabled = true
@@ -693,6 +623,35 @@ Once you finish one of the goals, the test is considered to be completed, and fi
693
623
 
694
624
  **Bad Example**: Test both how button color affects signup *and* how it affects login, at the same time. THIS WILL NOT WORK.
695
625
 
626
+ #### Combined Experiments
627
+ If you want to test how how button color affects signup *and* how it affects login, at the same time. Use combined tests
628
+ Configure like so
629
+ ```ruby
630
+ Split.configuration.experiments = {
631
+ :button_color_experiment => {
632
+ :alternatives => ["blue", "green"],
633
+ :combined_experiments => ["button_color_on_signup", "button_color_on_login"]
634
+ }
635
+ }
636
+ ```
637
+
638
+ Starting the combined test starts all combined experiments
639
+ ```ruby
640
+ ab_combined_test(:button_color_experiment)
641
+ ```
642
+ Finish each combined test as normal
643
+
644
+ ```ruby
645
+ ab_finished(:button_color_on_login)
646
+ ab_finished(:button_color_on_signup)
647
+ ```
648
+
649
+ **Additional Configuration**:
650
+ * Be sure to enable `allow_multiple_experiments`
651
+ * In Sinatra include the CombinedExperimentsHelper
652
+ ```
653
+ helpers Split::CombinedExperimentsHelper
654
+ ```
696
655
  ### DB failover solution
697
656
 
698
657
  Due to the fact that Redis has no automatic failover mechanism, it's
@@ -811,12 +770,12 @@ end
811
770
 
812
771
  ## Extensions
813
772
 
814
- - [Split::Export](http://github.com/splitrb/split-export) - easily export ab test data out of Split
815
- - [Split::Analytics](http://github.com/splitrb/split-analytics) - push test data to google analytics
816
- - [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - store experiment data in mongoid (still uses redis)
817
- - [Split::Cacheable](https://github.com/harrystech/split_cacheable) - automatically create cache buckets per test
818
- - [Split::Counters](https://github.com/bernardkroes/split-counters) - add counters per experiment and alternative
819
- - [Split::Cli](https://github.com/craigmcnamara/split-cli) - a CLI to trigger Split A/B tests
773
+ - [Split::Export](http://github.com/splitrb/split-export) - Easily export A/B test data out of Split.
774
+ - [Split::Analytics](http://github.com/splitrb/split-analytics) - Push test data to Google Analytics.
775
+ - [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - Store experiment data in mongoid (still uses redis).
776
+ - [Split::Cacheable](https://github.com/harrystech/split_cacheable) - Automatically create cache buckets per test.
777
+ - [Split::Counters](https://github.com/bernardkroes/split-counters) - Add counters per experiment and alternative.
778
+ - [Split::Cli](https://github.com/craigmcnamara/split-cli) - A CLI to trigger Split A/B tests.
820
779
 
821
780
  ## Screencast
822
781
 
@@ -824,15 +783,93 @@ Ryan bates has produced an excellent 10 minute screencast about split on the Rai
824
783
 
825
784
  ## Blogposts
826
785
 
827
- * [A/B Testing with Split in Ruby on Rails](http://grinnick.com/posts/a-b-testing-with-split-in-ruby-on-rails)
828
786
  * [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)
829
787
  * [Rails A/B testing with Split on Heroku](http://blog.nathanhumbert.com/2012/02/rails-ab-testing-with-split-on-heroku.html)
830
788
 
831
- ## Contributors
789
+ ## Backers
832
790
 
833
- Over 70 different people have contributed to the project, you can see them all here: https://github.com/splitrb/split/graphs/contributors
791
+ Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/split#backer)]
834
792
 
835
- ## Development
793
+ <a href="https://opencollective.com/split/backer/0/website" target="_blank"><img src="https://opencollective.com/split/backer/0/avatar.svg"></a>
794
+ <a href="https://opencollective.com/split/backer/1/website" target="_blank"><img src="https://opencollective.com/split/backer/1/avatar.svg"></a>
795
+ <a href="https://opencollective.com/split/backer/2/website" target="_blank"><img src="https://opencollective.com/split/backer/2/avatar.svg"></a>
796
+ <a href="https://opencollective.com/split/backer/3/website" target="_blank"><img src="https://opencollective.com/split/backer/3/avatar.svg"></a>
797
+ <a href="https://opencollective.com/split/backer/4/website" target="_blank"><img src="https://opencollective.com/split/backer/4/avatar.svg"></a>
798
+ <a href="https://opencollective.com/split/backer/5/website" target="_blank"><img src="https://opencollective.com/split/backer/5/avatar.svg"></a>
799
+ <a href="https://opencollective.com/split/backer/6/website" target="_blank"><img src="https://opencollective.com/split/backer/6/avatar.svg"></a>
800
+ <a href="https://opencollective.com/split/backer/7/website" target="_blank"><img src="https://opencollective.com/split/backer/7/avatar.svg"></a>
801
+ <a href="https://opencollective.com/split/backer/8/website" target="_blank"><img src="https://opencollective.com/split/backer/8/avatar.svg"></a>
802
+ <a href="https://opencollective.com/split/backer/9/website" target="_blank"><img src="https://opencollective.com/split/backer/9/avatar.svg"></a>
803
+ <a href="https://opencollective.com/split/backer/10/website" target="_blank"><img src="https://opencollective.com/split/backer/10/avatar.svg"></a>
804
+ <a href="https://opencollective.com/split/backer/11/website" target="_blank"><img src="https://opencollective.com/split/backer/11/avatar.svg"></a>
805
+ <a href="https://opencollective.com/split/backer/12/website" target="_blank"><img src="https://opencollective.com/split/backer/12/avatar.svg"></a>
806
+ <a href="https://opencollective.com/split/backer/13/website" target="_blank"><img src="https://opencollective.com/split/backer/13/avatar.svg"></a>
807
+ <a href="https://opencollective.com/split/backer/14/website" target="_blank"><img src="https://opencollective.com/split/backer/14/avatar.svg"></a>
808
+ <a href="https://opencollective.com/split/backer/15/website" target="_blank"><img src="https://opencollective.com/split/backer/15/avatar.svg"></a>
809
+ <a href="https://opencollective.com/split/backer/16/website" target="_blank"><img src="https://opencollective.com/split/backer/16/avatar.svg"></a>
810
+ <a href="https://opencollective.com/split/backer/17/website" target="_blank"><img src="https://opencollective.com/split/backer/17/avatar.svg"></a>
811
+ <a href="https://opencollective.com/split/backer/18/website" target="_blank"><img src="https://opencollective.com/split/backer/18/avatar.svg"></a>
812
+ <a href="https://opencollective.com/split/backer/19/website" target="_blank"><img src="https://opencollective.com/split/backer/19/avatar.svg"></a>
813
+ <a href="https://opencollective.com/split/backer/20/website" target="_blank"><img src="https://opencollective.com/split/backer/20/avatar.svg"></a>
814
+ <a href="https://opencollective.com/split/backer/21/website" target="_blank"><img src="https://opencollective.com/split/backer/21/avatar.svg"></a>
815
+ <a href="https://opencollective.com/split/backer/22/website" target="_blank"><img src="https://opencollective.com/split/backer/22/avatar.svg"></a>
816
+ <a href="https://opencollective.com/split/backer/23/website" target="_blank"><img src="https://opencollective.com/split/backer/23/avatar.svg"></a>
817
+ <a href="https://opencollective.com/split/backer/24/website" target="_blank"><img src="https://opencollective.com/split/backer/24/avatar.svg"></a>
818
+ <a href="https://opencollective.com/split/backer/25/website" target="_blank"><img src="https://opencollective.com/split/backer/25/avatar.svg"></a>
819
+ <a href="https://opencollective.com/split/backer/26/website" target="_blank"><img src="https://opencollective.com/split/backer/26/avatar.svg"></a>
820
+ <a href="https://opencollective.com/split/backer/27/website" target="_blank"><img src="https://opencollective.com/split/backer/27/avatar.svg"></a>
821
+ <a href="https://opencollective.com/split/backer/28/website" target="_blank"><img src="https://opencollective.com/split/backer/28/avatar.svg"></a>
822
+ <a href="https://opencollective.com/split/backer/29/website" target="_blank"><img src="https://opencollective.com/split/backer/29/avatar.svg"></a>
823
+
824
+
825
+ ## Sponsors
826
+
827
+ Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/split#sponsor)]
828
+
829
+ <a href="https://opencollective.com/split/sponsor/0/website" target="_blank"><img src="https://opencollective.com/split/sponsor/0/avatar.svg"></a>
830
+ <a href="https://opencollective.com/split/sponsor/1/website" target="_blank"><img src="https://opencollective.com/split/sponsor/1/avatar.svg"></a>
831
+ <a href="https://opencollective.com/split/sponsor/2/website" target="_blank"><img src="https://opencollective.com/split/sponsor/2/avatar.svg"></a>
832
+ <a href="https://opencollective.com/split/sponsor/3/website" target="_blank"><img src="https://opencollective.com/split/sponsor/3/avatar.svg"></a>
833
+ <a href="https://opencollective.com/split/sponsor/4/website" target="_blank"><img src="https://opencollective.com/split/sponsor/4/avatar.svg"></a>
834
+ <a href="https://opencollective.com/split/sponsor/5/website" target="_blank"><img src="https://opencollective.com/split/sponsor/5/avatar.svg"></a>
835
+ <a href="https://opencollective.com/split/sponsor/6/website" target="_blank"><img src="https://opencollective.com/split/sponsor/6/avatar.svg"></a>
836
+ <a href="https://opencollective.com/split/sponsor/7/website" target="_blank"><img src="https://opencollective.com/split/sponsor/7/avatar.svg"></a>
837
+ <a href="https://opencollective.com/split/sponsor/8/website" target="_blank"><img src="https://opencollective.com/split/sponsor/8/avatar.svg"></a>
838
+ <a href="https://opencollective.com/split/sponsor/9/website" target="_blank"><img src="https://opencollective.com/split/sponsor/9/avatar.svg"></a>
839
+ <a href="https://opencollective.com/split/sponsor/10/website" target="_blank"><img src="https://opencollective.com/split/sponsor/10/avatar.svg"></a>
840
+ <a href="https://opencollective.com/split/sponsor/11/website" target="_blank"><img src="https://opencollective.com/split/sponsor/11/avatar.svg"></a>
841
+ <a href="https://opencollective.com/split/sponsor/12/website" target="_blank"><img src="https://opencollective.com/split/sponsor/12/avatar.svg"></a>
842
+ <a href="https://opencollective.com/split/sponsor/13/website" target="_blank"><img src="https://opencollective.com/split/sponsor/13/avatar.svg"></a>
843
+ <a href="https://opencollective.com/split/sponsor/14/website" target="_blank"><img src="https://opencollective.com/split/sponsor/14/avatar.svg"></a>
844
+ <a href="https://opencollective.com/split/sponsor/15/website" target="_blank"><img src="https://opencollective.com/split/sponsor/15/avatar.svg"></a>
845
+ <a href="https://opencollective.com/split/sponsor/16/website" target="_blank"><img src="https://opencollective.com/split/sponsor/16/avatar.svg"></a>
846
+ <a href="https://opencollective.com/split/sponsor/17/website" target="_blank"><img src="https://opencollective.com/split/sponsor/17/avatar.svg"></a>
847
+ <a href="https://opencollective.com/split/sponsor/18/website" target="_blank"><img src="https://opencollective.com/split/sponsor/18/avatar.svg"></a>
848
+ <a href="https://opencollective.com/split/sponsor/19/website" target="_blank"><img src="https://opencollective.com/split/sponsor/19/avatar.svg"></a>
849
+ <a href="https://opencollective.com/split/sponsor/20/website" target="_blank"><img src="https://opencollective.com/split/sponsor/20/avatar.svg"></a>
850
+ <a href="https://opencollective.com/split/sponsor/21/website" target="_blank"><img src="https://opencollective.com/split/sponsor/21/avatar.svg"></a>
851
+ <a href="https://opencollective.com/split/sponsor/22/website" target="_blank"><img src="https://opencollective.com/split/sponsor/22/avatar.svg"></a>
852
+ <a href="https://opencollective.com/split/sponsor/23/website" target="_blank"><img src="https://opencollective.com/split/sponsor/23/avatar.svg"></a>
853
+ <a href="https://opencollective.com/split/sponsor/24/website" target="_blank"><img src="https://opencollective.com/split/sponsor/24/avatar.svg"></a>
854
+ <a href="https://opencollective.com/split/sponsor/25/website" target="_blank"><img src="https://opencollective.com/split/sponsor/25/avatar.svg"></a>
855
+ <a href="https://opencollective.com/split/sponsor/26/website" target="_blank"><img src="https://opencollective.com/split/sponsor/26/avatar.svg"></a>
856
+ <a href="https://opencollective.com/split/sponsor/27/website" target="_blank"><img src="https://opencollective.com/split/sponsor/27/avatar.svg"></a>
857
+ <a href="https://opencollective.com/split/sponsor/28/website" target="_blank"><img src="https://opencollective.com/split/sponsor/28/avatar.svg"></a>
858
+ <a href="https://opencollective.com/split/sponsor/29/website" target="_blank"><img src="https://opencollective.com/split/sponsor/29/avatar.svg"></a>
859
+
860
+ ## Contribute
861
+
862
+ Please do! Over 70 different people have contributed to the project, you can see them all here: https://github.com/splitrb/split/graphs/contributors.
863
+
864
+ ### Development
865
+
866
+ The source code is hosted at [GitHub](http://github.com/splitrb/split).
867
+
868
+ Report issues and feature requests on [GitHub Issues](http://github.com/splitrb/split/issues).
869
+
870
+ You can find a discussion form on [Google Groups](https://groups.google.com/d/forum/split-ruby).
871
+
872
+ ### Tests
836
873
 
837
874
  Run the tests like this:
838
875
 
@@ -842,23 +879,21 @@ Run the tests like this:
842
879
  bundle
843
880
  rake spec
844
881
 
845
- Source hosted at [GitHub](http://github.com/splitrb/split).
846
-
847
- Report Issues/Feature requests on [GitHub Issues](http://github.com/splitrb/split/issues).
848
-
849
- Discussion at [Google Groups](https://groups.google.com/d/forum/split-ruby).
850
-
851
- ### Note on Patches/Pull Requests
882
+ ### A Note on Patches and Pull Requests
852
883
 
853
884
  * Fork the project.
854
885
  * Make your feature addition or bug fix.
855
886
  * Add tests for it. This is important so I don't break it in a
856
887
  future version unintentionally.
857
888
  * Add documentation if necessary.
858
- * Commit, do not mess with rakefile, version, or history.
859
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
889
+ * Commit. Do not mess with the rakefile, version, or history.
890
+ (If you want to have your own version, that is fine. But bump the version in a commit by itself, which I can ignore when I pull.)
860
891
  * Send a pull request. Bonus points for topic branches.
861
892
 
893
+ ### Code of Conduct
894
+
895
+ Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
896
+
862
897
  ## Copyright
863
898
 
864
- Copyright (c) 2016 Andrew Nesbitt. See [LICENSE](https://github.com/splitrb/split/blob/master/LICENSE) for details.
899
+ [MIT License](LICENSE) © 2017 [Andrew Nesbitt](https://github.com/andrew).
@@ -6,4 +6,4 @@ gem "appraisal"
6
6
  gem "codeclimate-test-reporter"
7
7
  gem "rails", "~> 4.2"
8
8
 
9
- gemspec :path => "../"
9
+ gemspec path: "../"
@@ -5,6 +5,6 @@ source "https://rubygems.org"
5
5
  gem "appraisal"
6
6
  gem "codeclimate-test-reporter"
7
7
  gem "rails", "~> 5.0"
8
- gem "sinatra", :git => "https://github.com/sinatra/sinatra"
8
+ gem "sinatra", git: "https://github.com/sinatra/sinatra"
9
9
 
10
- gemspec :path => "../"
10
+ gemspec path: "../"
@@ -0,0 +1,10 @@
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", "~> 5.1"
8
+ gem "sinatra", git: "https://github.com/sinatra/sinatra"
9
+
10
+ gemspec path: "../"
@@ -13,6 +13,7 @@ require 'split/experiment_catalog'
13
13
  require 'split/extensions/string'
14
14
  require 'split/goals_collection'
15
15
  require 'split/helper'
16
+ require 'split/combined_experiments_helper'
16
17
  require 'split/metric'
17
18
  require 'split/persistence'
18
19
  require 'split/redis_interface'
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+ module Split
3
+ module CombinedExperimentsHelper
4
+ def ab_combined_test(metric_descriptor, control = nil, *alternatives)
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?
7
+
8
+ alternative = nil
9
+ experiment[:combined_experiments].each do |combined_experiment|
10
+ if alternative.nil?
11
+ if control
12
+ alternative = ab_test(combined_experiment, control, alternatives)
13
+ else
14
+ normalized_alternatives = Split::Configuration.new.normalize_alternatives(experiment[:alternatives])
15
+ alternative = ab_test(combined_experiment, normalized_alternatives[0], *normalized_alternatives[1])
16
+ end
17
+ else
18
+ ab_test(combined_experiment, [{alternative => 1}])
19
+ end
20
+ end
21
+ end
22
+
23
+ def find_combined_experiment(metric_descriptor)
24
+ raise(Split::InvalidExperimentsFormatError, 'Invalid descriptor class (String or Symbol required)') unless metric_descriptor.class == String || metric_descriptor.class == Symbol
25
+ raise(Split::InvalidExperimentsFormatError, 'Enable configuration') unless Split.configuration.enabled
26
+ raise(Split::InvalidExperimentsFormatError, 'Enable `allow_multiple_experiments`') unless Split.configuration.allow_multiple_experiments
27
+ experiment = Split::configuration.experiments[metric_descriptor.to_sym]
28
+ end
29
+ end
30
+ end
@@ -48,7 +48,9 @@ module Split
48
48
  'spider' => 'generic web spider',
49
49
  'UnwindFetchor' => 'Gnip crawler',
50
50
  'WordPress' => 'WordPress spider',
51
+ 'YandexAccessibilityBot' => 'Yandex accessibility spider',
51
52
  'YandexBot' => 'Yandex spider',
53
+ 'YandexMobileBot' => 'Yandex mobile spider',
52
54
  'ZIBB' => 'ZIBB spider',
53
55
 
54
56
  # HTTP libraries
@@ -73,10 +75,13 @@ module Split
73
75
  'facebookexternalhit' => 'facebook bot',
74
76
  'Feedfetcher-Google' => 'Google Feedfetcher',
75
77
  'https://developers.google.com/+/web/snippet' => 'Google+ Snippet Fetcher',
78
+ 'LinkedInBot' => 'LinkedIn bot',
76
79
  'LongURL' => 'URL expander service',
77
80
  'NING' => 'NING - Yet Another Twitter Swarmer',
81
+ 'Pinterest' => 'Pinterest Bot',
78
82
  'redditbot' => 'Reddit Bot',
79
83
  'ShortLinkTranslate' => 'Link shortener',
84
+ 'Slackbot' => 'Slackbot link expander',
80
85
  'TweetmemeBot' => 'TweetMeMe Crawler',
81
86
  'Twitterbot' => 'Twitter URL expander',
82
87
  'UnwindFetch' => 'Gnip URL expander',
@@ -5,6 +5,8 @@ module Split
5
5
  if Split.configuration.include_rails_helper
6
6
  ActionController::Base.send :include, Split::Helper
7
7
  ActionController::Base.helper Split::Helper
8
+ ActionController::Base.send :include, Split::CombinedExperimentsHelper
9
+ ActionController::Base.helper Split::CombinedExperimentsHelper
8
10
  end
9
11
  end
10
12
  end
@@ -10,6 +10,7 @@ module Split
10
10
  experiment = ExperimentCatalog.find_or_initialize(metric_descriptor, control, *alternatives)
11
11
  alternative = if Split.configuration.enabled
12
12
  experiment.save
13
+ raise(Split::InvalidExperimentsFormatError) unless Split::configuration.experiments&.dig(experiment.name.to_sym,:combined_experiments).nil?
13
14
  trial = Trial.new(:user => ab_user, :experiment => experiment,
14
15
  :override => override_alternative(experiment.name), :exclude => exclude_visitor?,
15
16
  :disabled => split_generically_disabled?)
@@ -96,6 +97,14 @@ module Split
96
97
  Split.configuration.db_failover_on_db_error.call(e)
97
98
  end
98
99
 
100
+ def ab_active_experiments()
101
+ ab_user.active_experiments
102
+ rescue => e
103
+ raise unless Split.configuration.db_failover
104
+ Split.configuration.db_failover_on_db_error.call(e)
105
+ end
106
+
107
+
99
108
  def override_present?(experiment_name)
100
109
  override_alternative(experiment_name)
101
110
  end
@@ -6,20 +6,21 @@ module Split
6
6
  class CookieAdapter
7
7
 
8
8
  def initialize(context)
9
- @cookies = context.send(:cookies)
9
+ @request, @response = context.request, context.response
10
+ @cookies = @request.cookies
10
11
  @expires = Time.now + cookie_length_config
11
12
  end
12
13
 
13
14
  def [](key)
14
- hash[key]
15
+ hash[key.to_s]
15
16
  end
16
17
 
17
18
  def []=(key, value)
18
- set_cookie(hash.merge(key => value))
19
+ set_cookie(hash.merge!(key.to_s => value))
19
20
  end
20
21
 
21
22
  def delete(key)
22
- set_cookie(hash.tap { |h| h.delete(key) })
23
+ set_cookie(hash.tap { |h| h.delete(key.to_s) })
23
24
  end
24
25
 
25
26
  def keys
@@ -28,22 +29,25 @@ module Split
28
29
 
29
30
  private
30
31
 
31
- def set_cookie(value)
32
- @cookies[:split] = {
33
- :value => JSON.generate(value),
34
- :expires => @expires
35
- }
32
+ def set_cookie(value = {})
33
+ @response.set_cookie :split.to_s, default_options.merge(value: JSON.generate(value))
34
+ end
35
+
36
+ def default_options
37
+ { expires: @expires, path: '/' }
36
38
  end
37
39
 
38
40
  def hash
39
- if @cookies[:split]
40
- begin
41
- JSON.parse(@cookies[:split])
42
- rescue JSON::ParserError
41
+ @hash ||= begin
42
+ if cookies = @cookies[:split.to_s]
43
+ begin
44
+ JSON.parse(cookies)
45
+ rescue JSON::ParserError
46
+ {}
47
+ end
48
+ else
43
49
  {}
44
50
  end
45
- else
46
- {}
47
51
  end
48
52
  end
49
53
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  module Split
3
3
  MAJOR = 3
4
- MINOR = 0
4
+ MINOR = 1
5
5
  PATCH = 0
6
6
  VERSION = [MAJOR, MINOR, PATCH].join('.')
7
7
  end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+ require 'spec_helper'
3
+ require 'split/combined_experiments_helper'
4
+
5
+ describe Split::CombinedExperimentsHelper do
6
+ include Split::CombinedExperimentsHelper
7
+
8
+ describe 'ab_combined_test' do
9
+ let!(:config_enabled) { true }
10
+ let!(:combined_experiments) { [:exp_1_click, :exp_1_scroll ]}
11
+ let!(:allow_multiple_experiments) { true }
12
+
13
+ before do
14
+ Split.configuration.experiments = {
15
+ :combined_exp_1 => {
16
+ :alternatives => [ {"control"=> 0.5}, {"test-alt"=> 0.5} ],
17
+ :metric => :my_metric,
18
+ :combined_experiments => combined_experiments
19
+ }
20
+ }
21
+ Split.configuration.enabled = config_enabled
22
+ Split.configuration.allow_multiple_experiments = allow_multiple_experiments
23
+ end
24
+
25
+ context 'without config enabled' do
26
+ let!(:config_enabled) { false }
27
+
28
+ it "raises an error" do
29
+ expect(lambda { ab_combined_test :combined_exp_1 }).to raise_error(Split::InvalidExperimentsFormatError )
30
+ end
31
+ end
32
+
33
+ context 'multiple experiments disabled' do
34
+ let!(:allow_multiple_experiments) { false }
35
+
36
+ it "raises an error if multiple experiments is disabled" do
37
+ expect(lambda { ab_combined_test :combined_exp_1 }).to raise_error(Split::InvalidExperimentsFormatError)
38
+ end
39
+ end
40
+
41
+ context 'without combined experiments' do
42
+ let!(:combined_experiments) { nil }
43
+
44
+ it "raises an error" do
45
+ expect(lambda { ab_combined_test :combined_exp_1 }).to raise_error(Split::InvalidExperimentsFormatError )
46
+ end
47
+ end
48
+
49
+ it "uses same alternatives for all sub experiments " do
50
+ allow(self).to receive(:get_alternative) { "test-alt" }
51
+ expect(self).to receive(:ab_test).with(:exp_1_click, {"control"=>0.5}, {"test-alt"=>0.5}) { "test-alt" }
52
+ expect(self).to receive(:ab_test).with(:exp_1_scroll, [{"test-alt" => 1}] )
53
+
54
+ ab_combined_test('combined_exp_1')
55
+ end
56
+ end
57
+ end
@@ -35,6 +35,18 @@ describe Split::Helper do
35
35
  expect(lambda { ab_test({'link_color' => "purchase"}, 'blue', 'red') }).not_to raise_error
36
36
  end
37
37
 
38
+ it "raises an appropriate error when processing combined expirements" do
39
+ Split.configuration.experiments = {
40
+ :combined_exp_1 => {
41
+ :alternatives => [ { name: "control", percent: 50 }, { name: "test-alt", percent: 50 } ],
42
+ :metric => :my_metric,
43
+ :combined_experiments => [:combined_exp_1_sub_1]
44
+ }
45
+ }
46
+ Split::ExperimentCatalog.find_or_create('combined_exp_1')
47
+ expect(lambda { ab_test('combined_exp_1')}).to raise_error(Split::InvalidExperimentsFormatError )
48
+ end
49
+
38
50
  it "should assign a random alternative to a new user when there are an equal number of alternatives assigned" do
39
51
  ab_test('link_color', 'blue', 'red')
40
52
  expect(['red', 'blue']).to include(ab_user['link_color'])
@@ -1,9 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
  require "spec_helper"
3
+ require 'rack/test'
3
4
 
4
5
  describe Split::Persistence::CookieAdapter do
5
6
 
6
- let(:context) { double(:cookies => CookiesMock.new) }
7
+ let(:env) { Rack::MockRequest.env_for("http://example.com:8080/") }
8
+ let(:request) { Rack::Request.new(env) }
9
+ let(:response) { Rack::MockResponse.new(200, {}, "") }
10
+ let(:context) { double(request: request, response: response) }
7
11
  subject { Split::Persistence::CookieAdapter.new(context) }
8
12
 
9
13
  describe "#[] and #[]=" do
@@ -30,7 +34,7 @@ describe Split::Persistence::CookieAdapter do
30
34
  end
31
35
 
32
36
  it "handles invalid JSON" do
33
- context.cookies[:split] = { :value => '{"foo":2,', :expires => Time.now }
37
+ context.request.cookies[:split] = { :value => '{"foo":2,', :expires => Time.now }
34
38
  expect(subject["my_key"]).to be_nil
35
39
  subject["my_key"] = "my_value"
36
40
  expect(subject["my_key"]).to eq("my_value")
@@ -12,6 +12,15 @@ Gem::Specification.new do |s|
12
12
  s.homepage = "https://github.com/splitrb/split"
13
13
  s.summary = "Rack based split testing framework"
14
14
 
15
+ s.metadata = {
16
+ "homepage_uri" => "https://github.com/splitrb/split",
17
+ "changelog_uri" => "https://github.com/splitrb/split/blob/master/CHANGELOG.md",
18
+ "source_code_uri" => "https://github.com/splitrb/split",
19
+ "bug_tracker_uri" => "https://github.com/splitrb/split/issues",
20
+ "wiki_uri" => "https://github.com/splitrb/split/wiki",
21
+ "mailing_list_uri" => "https://groups.google.com/d/forum/split-ruby"
22
+ }
23
+
15
24
  s.required_ruby_version = '>= 1.9.2'
16
25
 
17
26
  s.rubyforge_project = "split"
@@ -24,10 +33,10 @@ Gem::Specification.new do |s|
24
33
  s.add_dependency 'sinatra', '>= 1.2.6'
25
34
  s.add_dependency 'simple-random', '>= 0.9.3'
26
35
 
27
- s.add_development_dependency 'bundler', '~> 1.10'
36
+ s.add_development_dependency 'bundler', '~> 1.14'
28
37
  s.add_development_dependency 'simplecov', '~> 0.12'
29
38
  s.add_development_dependency 'rack-test', '~> 0.6'
30
- s.add_development_dependency 'rake', '~> 11.1'
39
+ s.add_development_dependency 'rake', '~> 12'
31
40
  s.add_development_dependency 'rspec', '~> 3.4'
32
41
  s.add_development_dependency 'pry', '~> 0.10'
33
42
  s.add_development_dependency 'fakeredis', '~> 0.6.0'
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: 3.0.0
4
+ version: 3.1.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: 2017-03-30 00:00:00.000000000 Z
11
+ date: 2017-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.10'
61
+ version: '1.14'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.10'
68
+ version: '1.14'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: simplecov
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +100,14 @@ dependencies:
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '11.1'
103
+ version: '12'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '11.1'
110
+ version: '12'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rspec
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -174,11 +174,13 @@ files:
174
174
  - Rakefile
175
175
  - gemfiles/4.2.gemfile
176
176
  - gemfiles/5.0.gemfile
177
+ - gemfiles/5.1.gemfile
177
178
  - lib/split.rb
178
179
  - lib/split/algorithms/block_randomization.rb
179
180
  - lib/split/algorithms/weighted_sample.rb
180
181
  - lib/split/algorithms/whiplash.rb
181
182
  - lib/split/alternative.rb
183
+ - lib/split/combined_experiments_helper.rb
182
184
  - lib/split/configuration.rb
183
185
  - lib/split/dashboard.rb
184
186
  - lib/split/dashboard/helpers.rb
@@ -215,6 +217,7 @@ files:
215
217
  - spec/algorithms/weighted_sample_spec.rb
216
218
  - spec/algorithms/whiplash_spec.rb
217
219
  - spec/alternative_spec.rb
220
+ - spec/combined_experiments_helper_spec.rb
218
221
  - spec/configuration_spec.rb
219
222
  - spec/dashboard_helpers_spec.rb
220
223
  - spec/dashboard_spec.rb
@@ -239,7 +242,13 @@ files:
239
242
  homepage: https://github.com/splitrb/split
240
243
  licenses:
241
244
  - MIT
242
- metadata: {}
245
+ metadata:
246
+ homepage_uri: https://github.com/splitrb/split
247
+ changelog_uri: https://github.com/splitrb/split/blob/master/CHANGELOG.md
248
+ source_code_uri: https://github.com/splitrb/split
249
+ bug_tracker_uri: https://github.com/splitrb/split/issues
250
+ wiki_uri: https://github.com/splitrb/split/wiki
251
+ mailing_list_uri: https://groups.google.com/d/forum/split-ruby
243
252
  post_install_message:
244
253
  rdoc_options: []
245
254
  require_paths:
@@ -265,6 +274,7 @@ test_files:
265
274
  - spec/algorithms/weighted_sample_spec.rb
266
275
  - spec/algorithms/whiplash_spec.rb
267
276
  - spec/alternative_spec.rb
277
+ - spec/combined_experiments_helper_spec.rb
268
278
  - spec/configuration_spec.rb
269
279
  - spec/dashboard_helpers_spec.rb
270
280
  - spec/dashboard_spec.rb