vinted-ab 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ab/assigned_test.rb +7 -3
- data/lib/ab/missing_variant.rb +7 -1
- data/lib/ab/version.rb +1 -1
- data/spec/assigned_test_spec.rb +1 -1
- data/spec/null_test_spec.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 524583866170f2c146e62a8e3e0856c70c182c30
|
4
|
+
data.tar.gz: 5d2eb21da061a576bf9ba799980f205c69cf5150
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f272ba169ff0cf3f0ca4c17595cc1d2a0ea2d66573534f2e4f1fd6f316b374dffba59f8b3561bffcc3af143908f8ee111d87689a45c37a5d6c5796498685ecd3
|
7
|
+
data.tar.gz: 58155d2dca6f2cc55cb61ba557e8ddd9d59126b282d6bd4588cf8e421e3d4c96af0956437b64a4bba65746cc6dea232566384c1876cd97efe029d9419d556f8c
|
data/lib/ab/assigned_test.rb
CHANGED
@@ -25,11 +25,11 @@ module Ab
|
|
25
25
|
return unless part_of_test?
|
26
26
|
return unless running?
|
27
27
|
|
28
|
-
AssignedTest.before.call(
|
28
|
+
AssignedTest.before.call(name) if run_callbacks && AssignedTest.before.respond_to?(:call)
|
29
29
|
picked_variant = @test.variants.find { |v| v.accumulated_chance_weight > weight_id }
|
30
30
|
|
31
31
|
result = picked_variant.name if picked_variant
|
32
|
-
AssignedTest.after.call(
|
32
|
+
AssignedTest.after.call(name, result) if run_callbacks && AssignedTest.after.respond_to?(:call)
|
33
33
|
result
|
34
34
|
end
|
35
35
|
end
|
@@ -48,6 +48,10 @@ module Ab
|
|
48
48
|
|
49
49
|
private
|
50
50
|
|
51
|
+
def name
|
52
|
+
@test.name
|
53
|
+
end
|
54
|
+
|
51
55
|
def part_of_test?
|
52
56
|
@test.all_buckets? ||
|
53
57
|
@test.buckets && @test.buckets.include?(bucket_id)
|
@@ -58,7 +62,7 @@ module Ab
|
|
58
62
|
end
|
59
63
|
|
60
64
|
def running?
|
61
|
-
DateTime.now.between?(
|
65
|
+
DateTime.now.between?(start_at, end_at)
|
62
66
|
end
|
63
67
|
|
64
68
|
def weight_id
|
data/lib/ab/missing_variant.rb
CHANGED
@@ -20,7 +20,13 @@ module Ab
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def log_missing_variant(meth)
|
23
|
-
|
23
|
+
return unless name
|
24
|
+
|
25
|
+
Ab.config.logger.debug("[AB_testing] Checking non-existing variant: #{name}##{meth}")
|
26
|
+
end
|
27
|
+
|
28
|
+
def name
|
29
|
+
nil
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
data/lib/ab/version.rb
CHANGED
data/spec/assigned_test_spec.rb
CHANGED
@@ -18,7 +18,7 @@ module Ab
|
|
18
18
|
|
19
19
|
context 'with non existent variant' do
|
20
20
|
let(:variants) { [OpenStruct.new(name: 'enabled', accumulated_chance_weight: 2)] }
|
21
|
-
let(:message) { '[AB_testing] Checking non-existing variant: disabled?' }
|
21
|
+
let(:message) { '[AB_testing] Checking non-existing variant: feed#disabled?' }
|
22
22
|
|
23
23
|
before { Ab.config.logger.should_receive(:debug).with(message) }
|
24
24
|
|
data/spec/null_test_spec.rb
CHANGED
@@ -8,8 +8,12 @@ module Ab
|
|
8
8
|
its(:start_at) { should_not be_nil }
|
9
9
|
its(:end_at) { should_not be_nil }
|
10
10
|
|
11
|
-
|
12
|
-
|
11
|
+
context 'with method ending in question mark' do
|
12
|
+
before { Ab.config.logger.should_not_receive(:debug) }
|
13
|
+
|
14
|
+
specify 'does not raise' do
|
15
|
+
lambda { subject.bla? }.should_not raise_error
|
16
|
+
end
|
13
17
|
end
|
14
18
|
|
15
19
|
specify 'raises for method not ending in question mark' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vinted-ab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mindaugas Mozūras
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-05-
|
12
|
+
date: 2015-05-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|