split 3.3.0 → 4.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc +1 -1
- data/.github/FUNDING.yml +1 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
- data/.rspec +1 -0
- data/.rubocop.yml +71 -1044
- data/.rubocop_todo.yml +226 -0
- data/.travis.yml +18 -39
- data/Appraisals +4 -0
- data/CHANGELOG.md +110 -0
- data/CODE_OF_CONDUCT.md +3 -3
- data/Gemfile +2 -0
- data/README.md +58 -23
- data/Rakefile +2 -0
- data/gemfiles/{4.2.gemfile → 6.0.gemfile} +1 -1
- data/lib/split.rb +16 -3
- data/lib/split/algorithms/block_randomization.rb +2 -0
- data/lib/split/algorithms/weighted_sample.rb +2 -1
- data/lib/split/algorithms/whiplash.rb +3 -2
- data/lib/split/alternative.rb +4 -3
- data/lib/split/cache.rb +28 -0
- data/lib/split/combined_experiments_helper.rb +3 -2
- data/lib/split/configuration.rb +15 -14
- data/lib/split/dashboard.rb +19 -1
- data/lib/split/dashboard/helpers.rb +3 -2
- data/lib/split/dashboard/pagination_helpers.rb +4 -4
- data/lib/split/dashboard/paginator.rb +1 -0
- data/lib/split/dashboard/public/dashboard.js +10 -0
- data/lib/split/dashboard/public/style.css +5 -0
- data/lib/split/dashboard/views/_controls.erb +13 -0
- data/lib/split/dashboard/views/layout.erb +1 -1
- data/lib/split/encapsulated_helper.rb +3 -2
- data/lib/split/engine.rb +7 -4
- data/lib/split/exceptions.rb +1 -0
- data/lib/split/experiment.rb +98 -65
- data/lib/split/experiment_catalog.rb +1 -3
- data/lib/split/extensions/string.rb +1 -0
- data/lib/split/goals_collection.rb +2 -0
- data/lib/split/helper.rb +30 -10
- data/lib/split/metric.rb +2 -1
- data/lib/split/persistence.rb +4 -2
- data/lib/split/persistence/cookie_adapter.rb +1 -0
- data/lib/split/persistence/dual_adapter.rb +54 -12
- data/lib/split/persistence/redis_adapter.rb +5 -0
- data/lib/split/persistence/session_adapter.rb +1 -0
- data/lib/split/redis_interface.rb +9 -28
- data/lib/split/trial.rb +25 -17
- data/lib/split/user.rb +19 -3
- data/lib/split/version.rb +2 -4
- data/lib/split/zscore.rb +1 -0
- data/spec/alternative_spec.rb +1 -1
- data/spec/cache_spec.rb +88 -0
- data/spec/configuration_spec.rb +1 -14
- data/spec/dashboard/pagination_helpers_spec.rb +3 -1
- data/spec/dashboard_helpers_spec.rb +2 -2
- data/spec/dashboard_spec.rb +78 -17
- data/spec/encapsulated_helper_spec.rb +2 -2
- data/spec/experiment_spec.rb +116 -12
- data/spec/goals_collection_spec.rb +1 -1
- data/spec/helper_spec.rb +191 -112
- data/spec/persistence/cookie_adapter_spec.rb +1 -1
- data/spec/persistence/dual_adapter_spec.rb +160 -68
- data/spec/persistence/redis_adapter_spec.rb +9 -0
- data/spec/redis_interface_spec.rb +0 -69
- data/spec/spec_helper.rb +5 -6
- data/spec/trial_spec.rb +65 -19
- data/spec/user_spec.rb +28 -0
- data/split.gemspec +9 -9
- metadata +34 -28
data/spec/user_spec.rb
CHANGED
@@ -59,6 +59,34 @@ describe Split::User do
|
|
59
59
|
expect(@subject.keys).to include("link_color:finished")
|
60
60
|
end
|
61
61
|
end
|
62
|
+
|
63
|
+
context 'when already cleaned up' do
|
64
|
+
before do
|
65
|
+
@subject.cleanup_old_experiments!
|
66
|
+
end
|
67
|
+
|
68
|
+
it 'does not clean up again' do
|
69
|
+
expect(@subject).to_not receive(:keys_without_finished)
|
70
|
+
@subject.cleanup_old_experiments!
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
context 'allows user to be loaded from adapter' do
|
76
|
+
it 'loads user from adapter (RedisAdapter)' do
|
77
|
+
user = Split::Persistence::RedisAdapter.new(nil, 112233)
|
78
|
+
user['foo'] = 'bar'
|
79
|
+
|
80
|
+
ab_user = Split::User.find(112233, :redis)
|
81
|
+
|
82
|
+
expect(ab_user['foo']).to eql('bar')
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'returns nil if adapter does not implement a finder method' do
|
86
|
+
ab_user = Split::User.find(112233, :dual_adapter)
|
87
|
+
expect(ab_user).to be_nil
|
88
|
+
end
|
89
|
+
|
62
90
|
end
|
63
91
|
|
64
92
|
context "instantiated with custom adapter" do
|
data/split.gemspec
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
2
4
|
$:.push File.expand_path("../lib", __FILE__)
|
3
5
|
require "split/version"
|
4
6
|
|
@@ -21,24 +23,22 @@ Gem::Specification.new do |s|
|
|
21
23
|
"mailing_list_uri" => "https://groups.google.com/d/forum/split-ruby"
|
22
24
|
}
|
23
25
|
|
24
|
-
s.required_ruby_version = '>=
|
26
|
+
s.required_ruby_version = '>= 2.5.0'
|
25
27
|
s.required_rubygems_version = '>= 2.0.0'
|
26
28
|
|
27
|
-
s.rubyforge_project = "split"
|
28
|
-
|
29
29
|
s.files = `git ls-files`.split("\n")
|
30
30
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
31
31
|
s.require_paths = ["lib"]
|
32
32
|
|
33
|
-
s.add_dependency 'redis', '>= 2
|
33
|
+
s.add_dependency 'redis', '>= 4.2'
|
34
34
|
s.add_dependency 'sinatra', '>= 1.2.6'
|
35
|
-
s.add_dependency '
|
35
|
+
s.add_dependency 'rubystats', '>= 0.3.0'
|
36
36
|
|
37
|
-
s.add_development_dependency 'bundler', '
|
37
|
+
s.add_development_dependency 'bundler', '>= 1.17'
|
38
38
|
s.add_development_dependency 'simplecov', '~> 0.15'
|
39
|
-
s.add_development_dependency 'rack-test', '~>
|
40
|
-
s.add_development_dependency 'rake', '~>
|
39
|
+
s.add_development_dependency 'rack-test', '~> 1.1'
|
40
|
+
s.add_development_dependency 'rake', '~> 13'
|
41
41
|
s.add_development_dependency 'rspec', '~> 3.7'
|
42
42
|
s.add_development_dependency 'pry', '~> 0.10'
|
43
|
-
s.add_development_dependency '
|
43
|
+
s.add_development_dependency 'rails', '>= 5.0'
|
44
44
|
end
|
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:
|
4
|
+
version: 4.0.0.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sinatra
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,33 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.2.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rubystats
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.3.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.3.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.17'
|
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.
|
68
|
+
version: '1.17'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: simplecov
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.1'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '13'
|
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: '
|
110
|
+
version: '13'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,20 +137,20 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.10'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: rails
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - "
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '0
|
145
|
+
version: '5.0'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - "
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0
|
153
|
-
description:
|
152
|
+
version: '5.0'
|
153
|
+
description:
|
154
154
|
email:
|
155
155
|
- andrewnez@gmail.com
|
156
156
|
executables: []
|
@@ -161,8 +161,12 @@ files:
|
|
161
161
|
- ".csslintrc"
|
162
162
|
- ".eslintignore"
|
163
163
|
- ".eslintrc"
|
164
|
+
- ".github/FUNDING.yml"
|
165
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
164
166
|
- ".gitignore"
|
167
|
+
- ".rspec"
|
165
168
|
- ".rubocop.yml"
|
169
|
+
- ".rubocop_todo.yml"
|
166
170
|
- ".travis.yml"
|
167
171
|
- Appraisals
|
168
172
|
- CHANGELOG.md
|
@@ -172,15 +176,16 @@ files:
|
|
172
176
|
- LICENSE
|
173
177
|
- README.md
|
174
178
|
- Rakefile
|
175
|
-
- gemfiles/4.2.gemfile
|
176
179
|
- gemfiles/5.0.gemfile
|
177
180
|
- gemfiles/5.1.gemfile
|
178
181
|
- gemfiles/5.2.gemfile
|
182
|
+
- gemfiles/6.0.gemfile
|
179
183
|
- lib/split.rb
|
180
184
|
- lib/split/algorithms/block_randomization.rb
|
181
185
|
- lib/split/algorithms/weighted_sample.rb
|
182
186
|
- lib/split/algorithms/whiplash.rb
|
183
187
|
- lib/split/alternative.rb
|
188
|
+
- lib/split/cache.rb
|
184
189
|
- lib/split/combined_experiments_helper.rb
|
185
190
|
- lib/split/configuration.rb
|
186
191
|
- lib/split/dashboard.rb
|
@@ -220,6 +225,7 @@ files:
|
|
220
225
|
- spec/algorithms/weighted_sample_spec.rb
|
221
226
|
- spec/algorithms/whiplash_spec.rb
|
222
227
|
- spec/alternative_spec.rb
|
228
|
+
- spec/cache_spec.rb
|
223
229
|
- spec/combined_experiments_helper_spec.rb
|
224
230
|
- spec/configuration_spec.rb
|
225
231
|
- spec/dashboard/pagination_helpers_spec.rb
|
@@ -254,7 +260,7 @@ metadata:
|
|
254
260
|
bug_tracker_uri: https://github.com/splitrb/split/issues
|
255
261
|
wiki_uri: https://github.com/splitrb/split/wiki
|
256
262
|
mailing_list_uri: https://groups.google.com/d/forum/split-ruby
|
257
|
-
post_install_message:
|
263
|
+
post_install_message:
|
258
264
|
rdoc_options: []
|
259
265
|
require_paths:
|
260
266
|
- lib
|
@@ -262,16 +268,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
268
|
requirements:
|
263
269
|
- - ">="
|
264
270
|
- !ruby/object:Gem::Version
|
265
|
-
version:
|
271
|
+
version: 2.5.0
|
266
272
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
267
273
|
requirements:
|
268
274
|
- - ">="
|
269
275
|
- !ruby/object:Gem::Version
|
270
276
|
version: 2.0.0
|
271
277
|
requirements: []
|
272
|
-
|
273
|
-
|
274
|
-
signing_key:
|
278
|
+
rubygems_version: 3.1.4
|
279
|
+
signing_key:
|
275
280
|
specification_version: 4
|
276
281
|
summary: Rack based split testing framework
|
277
282
|
test_files:
|
@@ -279,6 +284,7 @@ test_files:
|
|
279
284
|
- spec/algorithms/weighted_sample_spec.rb
|
280
285
|
- spec/algorithms/whiplash_spec.rb
|
281
286
|
- spec/alternative_spec.rb
|
287
|
+
- spec/cache_spec.rb
|
282
288
|
- spec/combined_experiments_helper_spec.rb
|
283
289
|
- spec/configuration_spec.rb
|
284
290
|
- spec/dashboard/pagination_helpers_spec.rb
|