split 0.7.1 → 0.7.2

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: 1819f5bb2d97f871dce0a859b30f0d6a10a94341
4
- data.tar.gz: b9026aa79967696c5f29de4ea320972257a0327d
3
+ metadata.gz: c1834f125bb0c03db28dc8b364780d88ca80c91a
4
+ data.tar.gz: c3ef6d85b761eda4171eacbc22aff42e25423a57
5
5
  SHA512:
6
- metadata.gz: 2736a69b3f38e61393b4bb3a44fa9bea24a5ed2982689eff841d1e3c2e9516cb870795bf2fd7299e394bd8c520a13335e8399163eacf92dd512cdd46cfeff212
7
- data.tar.gz: 3ca9fecdbe966b6e64586e3bcaa500be8daaa1b2a2aab2cefac664d98e73297f539b218fe9728a567fc612770bb947dcc2bd90db7343dc5a59490a9d3377aefd
6
+ metadata.gz: c8a2e79917f954236b2f58170eabb68672bd710474bee06b3787fc5a876bf2c8af9948c5be471bcf372bf0cb558dc74dda6214d194008268fe3e979bc0c94917
7
+ data.tar.gz: 42591e96c7458973b9eabb6e2e9c08d8e489ff6998701ff92424037f54462818248f0d536c8c5c3bd23da86092c1fca4ca3ee7b7430500b34dcfc21adebd6e34
data/README.mdown CHANGED
@@ -631,6 +631,7 @@ end
631
631
  - [Split::Export](http://github.com/andrew/split-export) - easily export ab test data out of Split
632
632
  - [Split::Analytics](http://github.com/andrew/split-analytics) - push test data to google analytics
633
633
  - [Split::Mongoid](https://github.com/MongoHQ/split-mongoid) - store experiment data in mongoid (still uses redis)
634
+ - [Split::Cacheable](https://github.com/harrystech/split_cacheable) - automatically create cache buckets per test
634
635
 
635
636
  ## Screencast
636
637
 
@@ -17,6 +17,9 @@ module Split
17
17
  get '/' do
18
18
  # Display experiments without a winner at the top of the dashboard
19
19
  @experiments = Split::Experiment.all_active_first
20
+
21
+ @metrics = Split::Metric.all
22
+
20
23
  # Display Rails Environment mode (or Rack version if not using Rails)
21
24
  if Object.const_defined?('Rails')
22
25
  @current_env = Rails.env.titlecase
@@ -9,6 +9,10 @@
9
9
  Experiment: <%= experiment.name %>
10
10
  <% if experiment.version > 1 %><span class='version'>v<%= experiment.version %></span><% end %>
11
11
  <% unless goal.nil? %><span class='goal'>Goal:<%= goal %></span><% end %>
12
+ <% metrics = @metrics.select {|metric| metric.experiments.include? experiment} %>
13
+ <% unless metrics.empty? %>
14
+ <span class='goal'>Metrics:<%= metrics.map(&:name).join(', ') %></span>
15
+ <% end %>
12
16
  </h2>
13
17
 
14
18
  <% if goal.nil? %>
@@ -1,7 +1,9 @@
1
1
  module Split
2
2
  class ExperimentCatalog
3
+ # Return all experiments
3
4
  def self.all
4
- Split.redis.smembers(:experiments).map {|e| find(e)}
5
+ # Call compact to prevent nil experiments from being returned -- seems to happen during gem upgrades
6
+ Split.redis.smembers(:experiments).map {|e| find(e)}.compact
5
7
  end
6
8
 
7
9
  # Return experiments without a winner (considered "active") first
data/lib/split/helper.rb CHANGED
@@ -166,7 +166,7 @@ module Split
166
166
 
167
167
  def start_trial(trial)
168
168
  experiment = trial.experiment
169
- if override_present?(experiment.name)
169
+ if override_present?(experiment.name) and experiment[override_alternative(experiment.name)]
170
170
  ret = override_alternative(experiment.name)
171
171
  ab_user[experiment.key] = ret if Split.configuration.store_override
172
172
  elsif experiment.has_winner?
data/lib/split/metric.rb CHANGED
@@ -42,6 +42,25 @@ module Split
42
42
  metric
43
43
  end
44
44
 
45
+ def self.find_or_create(attrs)
46
+ metric = find(attrs[:name])
47
+ unless metric
48
+ metric = new(attrs)
49
+ metric.save
50
+ end
51
+ metric
52
+ end
53
+
54
+ def self.all
55
+ redis_metrics = Split.redis.hgetall(:metrics).collect do |key, value|
56
+ find(key)
57
+ end
58
+ configuration_metrics = Split.configuration.metrics.collect do |key, value|
59
+ new(name: key, experiments: value)
60
+ end
61
+ redis_metrics | configuration_metrics
62
+ end
63
+
45
64
  def self.possible_experiments(metric_name)
46
65
  experiments = []
47
66
  metric = Split::Metric.find(metric_name)
@@ -78,4 +97,4 @@ module Split
78
97
  return metric_name, goals
79
98
  end
80
99
  end
81
- end
100
+ end
data/lib/split/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Split
2
2
  MAJOR = 0
3
3
  MINOR = 7
4
- PATCH = 1
4
+ PATCH = 2
5
5
  VERSION = [MAJOR, MINOR, PATCH].join('.')
6
6
  end
@@ -19,7 +19,7 @@ describe Split::DashboardHelpers do
19
19
  confidence_level(2.00).should eql('95% confidence')
20
20
  end
21
21
 
22
- it "should consider a z-score of z >= 2.58 as 95% confident" do
22
+ it "should consider a z-score of z >= 2.58 as 99% confident" do
23
23
  confidence_level(2.58).should eql('99% confidence')
24
24
  confidence_level(3.00).should eql('99% confidence')
25
25
  end
@@ -21,6 +21,10 @@ describe Split::Dashboard do
21
21
  Split::Experiment.find_or_create({"link_color" => ["goal_1", "goal_2"]}, "blue", "red")
22
22
  }
23
23
 
24
+ let(:metric) {
25
+ Split::Metric.find_or_create(name: 'testmetric', experiments: [experiment, experiment_with_goals])
26
+ }
27
+
24
28
  let(:red_link) { link("red") }
25
29
  let(:blue_link) { link("blue") }
26
30
 
@@ -43,6 +47,15 @@ describe Split::Dashboard do
43
47
  post "/start/#{experiment.name}"
44
48
  get '/'
45
49
  last_response.body.should include('Reset Data')
50
+ last_response.body.should_not include('Metrics:')
51
+ end
52
+ end
53
+
54
+ context "experiment with metrics" do
55
+ it "should display the names of associated metrics" do
56
+ metric
57
+ get '/'
58
+ last_response.body.should include('Metrics:testmetric')
46
59
  end
47
60
  end
48
61
 
data/spec/helper_spec.rb CHANGED
@@ -101,6 +101,12 @@ describe Split::Helper do
101
101
  alternative.should eql('red')
102
102
  end
103
103
 
104
+ it "should not allow an arbitrary alternative" do
105
+ @params = {'link_color' => 'pink'}
106
+ alternative = ab_test('link_color', 'blue')
107
+ alternative.should eql('blue')
108
+ end
109
+
104
110
  it "should not store the split when a param forced alternative" do
105
111
  @params = {'link_color' => 'blue'}
106
112
  ab_user.should_not_receive(:[]=)
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: split
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-20 00:00:00.000000000 Z
11
+ date: 2014-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.1'
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
26
  version: '2.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: redis-namespace
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sinatra
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.2.6
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
54
  version: 1.2.6
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: simple-random
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: bundler
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '1.3'
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
96
  version: '1.3'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '2.14'
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
110
  version: '2.14'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rack-test
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.5.7
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.5.7
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: coveralls
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  description:
@@ -143,8 +143,8 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - .gitignore
147
- - .travis.yml
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
148
  - Appraisals
149
149
  - CHANGELOG.mdown
150
150
  - CONTRIBUTING.md
@@ -220,17 +220,17 @@ require_paths:
220
220
  - lib
221
221
  required_ruby_version: !ruby/object:Gem::Requirement
222
222
  requirements:
223
- - - '>='
223
+ - - ">="
224
224
  - !ruby/object:Gem::Version
225
225
  version: '0'
226
226
  required_rubygems_version: !ruby/object:Gem::Requirement
227
227
  requirements:
228
- - - '>='
228
+ - - ">="
229
229
  - !ruby/object:Gem::Version
230
230
  version: '0'
231
231
  requirements: []
232
232
  rubyforge_project: split
233
- rubygems_version: 2.0.3
233
+ rubygems_version: 2.2.2
234
234
  signing_key:
235
235
  specification_version: 4
236
236
  summary: Rack based split testing framework