split_cacheable 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/lib/split_cacheable/version.rb +1 -1
- data/lib/split_cacheable.rb +7 -3
- data/spec/cacheable_spec.rb +5 -1
- data/spec/spec_helper.rb +5 -0
- data/split_cacheable.gemspec +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88bf6a45b6ca1479a616341ae2e5ac7ed63c2eee
|
4
|
+
data.tar.gz: c091304482e6a064c71c9759e615cf4eae60a157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f989aae4a469c7aa4c5fc3a0f7503b7b6fdadfb27befef780c55cc3d2e88f4f14a78ab92de4f72fbb91b5487e33a9b3d89b204ede51eb438a959640a026104c5
|
7
|
+
data.tar.gz: f6248284e6c30814e336c7e0e8094ce499509d82f6b01fea398ac3338ffb4552c85a132e5bb45dad264703434edba625129366ac2721701254f4be63bf6491a7
|
data/.travis.yml
CHANGED
data/lib/split_cacheable.rb
CHANGED
@@ -67,7 +67,7 @@ module Split
|
|
67
67
|
# Use this to clear all your action_caches
|
68
68
|
def get_all_possible_variations
|
69
69
|
test_variations = Array.new
|
70
|
-
active_tests.each { |test_obj|
|
70
|
+
active_tests.each { |test_obj|
|
71
71
|
split_test = Split::ExperimentCatalog.find(test_obj[:test_name])
|
72
72
|
if split_test
|
73
73
|
test_variations << split_test.alternatives.map { |alternative|
|
@@ -83,8 +83,12 @@ module Split
|
|
83
83
|
test_variations[0].unshift(DEFAULT_KEY)
|
84
84
|
return test_variations[0]
|
85
85
|
else
|
86
|
-
|
87
|
-
|
86
|
+
all_variations = []
|
87
|
+
test_variations.each.with_index(1) do |value, index|
|
88
|
+
test_variations.combination(index).each do |set|
|
89
|
+
all_variations += set.first.product(*set[1..-1]).map{|a| a.join("/")}
|
90
|
+
end
|
91
|
+
end
|
88
92
|
all_variations.unshift(DEFAULT_KEY)
|
89
93
|
return all_variations
|
90
94
|
end
|
data/spec/cacheable_spec.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Split::Cacheable do
|
4
|
-
ALL_VARIATIONS = [Split::Cacheable::Adapter::DEFAULT_KEY, "test_1/old/test_2/left", "test_1/old/test_2/right", "test_1/new/test_2/left", "test_1/new/test_2/right"]
|
4
|
+
ALL_VARIATIONS = [Split::Cacheable::Adapter::DEFAULT_KEY, "test_1/old", "test_1/new", "test_2/left", "test_2/right", "test_1/old/test_2/left", "test_1/old/test_2/right", "test_1/new/test_2/left", "test_1/new/test_2/right"]
|
5
5
|
|
6
6
|
it "should return the default variation if there is no request" do
|
7
7
|
expect(Split::Cacheable::Adapter.new(TestControllerWithoutRequest.new, :index).get_current_variations).to eql Split::Cacheable::Adapter::DEFAULT_KEY
|
@@ -35,5 +35,9 @@ describe Split::Cacheable do
|
|
35
35
|
it "should return one test plus the default key when there is one test" do
|
36
36
|
expect(Split::Cacheable::Adapter.new(TestControllerWithOneVariation.new, :index).get_all_possible_variations).to eql [Split::Cacheable::Adapter::DEFAULT_KEY, "test_1/old", "test_1/new"]
|
37
37
|
end
|
38
|
+
|
39
|
+
it "should return all possible variations of the cachekey when controller has multiple tests on same action" do
|
40
|
+
expect(Split::Cacheable::Adapter.new(TestControllerWithRequestAndMultiTestOnSameAction.new, :index).get_all_possible_variations).to eql ALL_VARIATIONS
|
41
|
+
end
|
38
42
|
end
|
39
43
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -80,4 +80,9 @@ class TestControllerWithRequestAndProc < TestControllerWithRequest
|
|
80
80
|
def mobile_device?
|
81
81
|
@is_mobile
|
82
82
|
end
|
83
|
+
end
|
84
|
+
|
85
|
+
class TestControllerWithRequestAndMultiTestOnSameAction < TestControllerWithRequest
|
86
|
+
cacheable_ab_test :test_1, :only => :index
|
87
|
+
cacheable_ab_test :test_2, :only => :index
|
83
88
|
end
|
data/split_cacheable.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "split", "
|
21
|
+
spec.add_dependency "split", "~> 1.0.0"
|
22
22
|
spec.add_dependency "activesupport", ">= 3.2.17"
|
23
23
|
|
24
24
|
spec.add_development_dependency "rspec", ">= 2.14"
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: split_cacheable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Schwartz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: split
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 1.0.0
|
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: 0.
|
26
|
+
version: 1.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,3 +146,4 @@ summary: We use action caching in Rails 3 to cache both our standard and mobile
|
|
146
146
|
test_files:
|
147
147
|
- spec/cacheable_spec.rb
|
148
148
|
- spec/spec_helper.rb
|
149
|
+
has_rdoc:
|