split 0.2.3 → 0.2.4
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/CHANGELOG.mdown +10 -0
- data/README.mdown +3 -1
- data/lib/split/experiment.rb +4 -1
- data/lib/split/helper.rb +2 -2
- data/lib/split/version.rb +1 -1
- data/spec/dashboard_spec.rb +2 -0
- data/spec/experiment_spec.rb +7 -0
- data/spec/helper_spec.rb +11 -0
- metadata +4 -4
data/CHANGELOG.mdown
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 0.2.4 (July 18, 2011)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- Added option to finished to not reset the users session
|
6
|
+
|
7
|
+
Bugfixes:
|
8
|
+
|
9
|
+
- Only allow strings as alternatives, fixes strange errors when passing true/false or symbols
|
10
|
+
|
1
11
|
## 0.2.3 (June 26, 2011)
|
2
12
|
|
3
13
|
Features:
|
data/README.mdown
CHANGED
@@ -95,6 +95,8 @@ Example: Conversion tracking (in a view)
|
|
95
95
|
|
96
96
|
Thanks for signing up, dude! <% finished("signup_page_redesign") >
|
97
97
|
|
98
|
+
You can find more examples, tutorials and guides on the [wiki](https://github.com/andrew/split/wiki).
|
99
|
+
|
98
100
|
### Overriding alternatives
|
99
101
|
|
100
102
|
For development and testing, you may wish to force your app to always return an alternative.
|
@@ -214,4 +216,4 @@ Tests can be ran with `rake spec`
|
|
214
216
|
|
215
217
|
## Copyright
|
216
218
|
|
217
|
-
Copyright (c) 2011 Andrew Nesbitt. See LICENSE for details.
|
219
|
+
Copyright (c) 2011 Andrew Nesbitt. See [LICENSE](https://github.com/andrew/split/blob/master/LICENSE) for details.
|
data/lib/split/experiment.rb
CHANGED
@@ -106,7 +106,10 @@ module Split
|
|
106
106
|
end
|
107
107
|
|
108
108
|
def self.find_or_create(key, *alternatives)
|
109
|
-
name = key.split(':')[0]
|
109
|
+
name = key.to_s.split(':')[0]
|
110
|
+
|
111
|
+
raise InvalidArgument, 'Alternatives must be strings' if alternatives.map(&:class).uniq != [String]
|
112
|
+
|
110
113
|
if Split.redis.exists(name)
|
111
114
|
if load_alternatives_for(name) == alternatives
|
112
115
|
experiment = self.new(name, *load_alternatives_for(name))
|
data/lib/split/helper.rb
CHANGED
@@ -34,13 +34,13 @@ module Split
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def finished(experiment_name)
|
37
|
+
def finished(experiment_name, options = {:reset => true})
|
38
38
|
return if exclude_visitor?
|
39
39
|
experiment = Split::Experiment.find(experiment_name)
|
40
40
|
if alternative_name = ab_user[experiment.key]
|
41
41
|
alternative = Split::Alternative.find(alternative_name, experiment_name)
|
42
42
|
alternative.increment_completion
|
43
|
-
session[:split].delete(experiment_name)
|
43
|
+
session[:split].delete(experiment_name) if options[:reset]
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
data/lib/split/version.rb
CHANGED
data/spec/dashboard_spec.rb
CHANGED
data/spec/experiment_spec.rb
CHANGED
@@ -160,4 +160,11 @@ describe Split::Experiment do
|
|
160
160
|
new_blue.participant_count.should eql(0)
|
161
161
|
end
|
162
162
|
end
|
163
|
+
|
164
|
+
describe 'alternatives passed as non-strings' do
|
165
|
+
it "should throw an exception if an alternative is passed that is not a string" do
|
166
|
+
lambda { Split::Experiment.find_or_create('link_color', :blue, :red) }.should raise_error
|
167
|
+
lambda { Split::Experiment.find_or_create('link_enabled', true, false) }.should raise_error
|
168
|
+
end
|
169
|
+
end
|
163
170
|
end
|
data/spec/helper_spec.rb
CHANGED
@@ -83,6 +83,17 @@ describe Split::Helper do
|
|
83
83
|
finished('link_color')
|
84
84
|
session[:split].should == {}
|
85
85
|
end
|
86
|
+
|
87
|
+
it "should not clear out the users session if reset is false" do
|
88
|
+
experiment = Split::Experiment.find_or_create('link_color', 'blue', 'red')
|
89
|
+
alternative_name = ab_test('link_color', 'blue', 'red')
|
90
|
+
|
91
|
+
previous_completion_count = Split::Alternative.find(alternative_name, 'link_color').completed_count
|
92
|
+
|
93
|
+
session[:split].should eql("link_color" => alternative_name)
|
94
|
+
finished('link_color', :reset => false)
|
95
|
+
session[:split].should eql("link_color" => alternative_name)
|
96
|
+
end
|
86
97
|
end
|
87
98
|
|
88
99
|
describe 'conversions' do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: split
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 4
|
10
|
+
version: 0.2.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andrew Nesbitt
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-07-18 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|