vinted-ab 0.2.3 → 0.2.4

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: 68b075c639ff1ef723c81b9f60ff1ac8f517f1dd
4
- data.tar.gz: df20ae610c9aa79b8204930fb3079f9edeb80132
3
+ metadata.gz: f6e46f66084e779a1eeca15edf6b3eba928b747b
4
+ data.tar.gz: 5e47066cb8520292d863b97be976f42c7d93e0fa
5
5
  SHA512:
6
- metadata.gz: 4f1dd1e36834fe06efc1318c4847a4b6121cb4093534a193a6ca321a4f5762696699e89a7d675b71423b2d7323302eb68889def55a0aca4833cb662a0ea502aa
7
- data.tar.gz: c6c2691cdd4fa3ba241e461930491324f31331fd675ba15edc9199ddefcb87fb7d456ae22e34e18ef1d18faf33437e202fa7ff9b17ba8568ac30279645f0f422
6
+ metadata.gz: ed4970561d2c2ec748f29ea3d5c378d8b181a1dea026a12d6d7eea4fcaa0d930c5c55283bead185d8d81bb9f35e5a13675d56e4f455397ec58456e431c46310b
7
+ data.tar.gz: b56781fed1989fe0f536afafbb7dcce815feb0a7bc99c2056bef91a5b15e4af1c5c5000eb6c02ec19277207da6a6493cc42fbf93994fcb48c791362ef106dd39
data/README.md CHANGED
@@ -54,8 +54,8 @@ An example config:
54
54
  {
55
55
  "id": 42,
56
56
  "name": "experiment",
57
- "start_at": "2014-05-21T11:06:30+03:00",
58
- "end_at": "2014-05-28T11:06:30+03:00",
57
+ "start_at": "2014-05-21T11:06:30+0300",
58
+ "end_at": "2014-05-28T11:06:30+0300",
59
59
  "seed": "aaaa1111",
60
60
  "buckets": [1, 2, 3, 4, 5],
61
61
  "variants": [
data/ab.gemspec CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.add_development_dependency 'bundler', '~> 1.3'
23
23
  spec.add_development_dependency 'rake', '~> 10.1', '>= 10.1.0'
24
24
  spec.add_development_dependency 'rspec', '~> 2.14', '>= 2.14.0'
25
+ spec.add_development_dependency 'rspec-its', '~> 1.0.1'
25
26
  spec.add_development_dependency 'json-schema', '~> 2.2.2', '>= 2.2.2'
26
27
  spec.add_development_dependency 'ruby-prof', '~> 0.15.0', '>= 0.15.0'
27
28
  spec.add_development_dependency 'pry', '~> 0.10.0', '>= 0.10.0'
@@ -2,7 +2,7 @@ module Ab
2
2
  class AssignedTest
3
3
  def initialize(test, id)
4
4
  @test, @id = test, id
5
- @test.variants.map(&:name).each do |name|
5
+ variants.each do |name|
6
6
  define_singleton_method("#{name}?") { name == variant }
7
7
  end
8
8
  end
@@ -40,6 +40,10 @@ module Ab
40
40
  @test.end_at
41
41
  end
42
42
 
43
+ def variants
44
+ @test.variants.map(&:name)
45
+ end
46
+
43
47
  private
44
48
 
45
49
  def part_of_test?
@@ -27,7 +27,6 @@ module Ab
27
27
  end
28
28
 
29
29
  def all
30
- # TODO: temporary feature to support old Vinted ab testing system
31
30
  Hash[@assigned_tests.map { |name, assigned_test| [name, assigned_test.variant(false)] }]
32
31
  end
33
32
 
@@ -1,3 +1,3 @@
1
1
  module Ab
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
@@ -6,8 +6,8 @@
6
6
  "id": 2,
7
7
  "name": "already_finished",
8
8
  "seed": "792e3b32a6dd59d3f300b2ac8b4caa09",
9
- "start_at": "1605-11-05T00:00:00+01:00",
10
- "end_at": "2014-02-01T02:15:00+03:00",
9
+ "start_at": "1605-11-05T00:00:00+0100",
10
+ "end_at": "2014-02-01T02:15:00+0300",
11
11
  "all_buckets": true,
12
12
  "variants": [
13
13
  {
@@ -6,8 +6,8 @@
6
6
  "id": 5,
7
7
  "name": "explicit_times",
8
8
  "seed": "2a14d8c5a30618799547e428dfa4a807",
9
- "start_at": "2013-01-01T00:00:00+00:00",
10
- "end_at": "2222-02-02T02:02:02+02:00",
9
+ "start_at": "2013-01-01T00:00:00+0000",
10
+ "end_at": "2222-02-02T02:02:02+0200",
11
11
  "all_buckets": true,
12
12
  "variants": [
13
13
  {
@@ -6,7 +6,7 @@
6
6
  "id": 2,
7
7
  "name": "has_not_started",
8
8
  "seed": "2",
9
- "start_at": "2444-01-01T00:00:00+00:00",
9
+ "start_at": "2444-01-01T00:00:00+0000",
10
10
  "all_buckets": true,
11
11
  "variants": [
12
12
  {
@@ -11,7 +11,7 @@ describe 'ab' do
11
11
 
12
12
  specify 'validates against schema' do
13
13
  result = JSON::Validator.validate(path_to_schema, input, version: :draft3)
14
- result.should be_true
14
+ result.should be true
15
15
  end
16
16
 
17
17
  specify 'correctly assigns variants' do
@@ -21,7 +21,7 @@ describe 'ab' do
21
21
  cases.each do |id, variant|
22
22
  tests = Ab::Tests.new(input, id)
23
23
  tests.send(output['test']).variant.to_s.should == variant
24
- tests.send(output['test']).send("#{variant}?").should be_true unless variant.empty?
24
+ tests.send(output['test']).send("#{variant}?").should be true unless variant.empty?
25
25
  end
26
26
  end
27
27
  end
@@ -1,7 +1,8 @@
1
1
  require 'rspec'
2
+ require 'rspec/its'
2
3
  require 'ab'
3
4
 
4
5
  RSpec.configure do |config|
5
- config.color_enabled = true
6
+ config.color = true
6
7
  config.treat_symbols_as_metadata_keys_with_true_values = true
7
8
  end
@@ -26,7 +26,7 @@ module Ab
26
26
  1.upto(10).each do |i|
27
27
  context "random method name of #{i} length" do
28
28
  let(:method_name) { SecureRandom.hex(i) }
29
- it { should be_true }
29
+ it { should be true }
30
30
  end
31
31
  end
32
32
  end
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.3
4
+ version: 0.2.4
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: 2014-07-07 00:00:00.000000000 Z
12
+ date: 2014-09-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
67
  version: 2.14.0
68
+ - !ruby/object:Gem::Dependency
69
+ name: rspec-its
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 1.0.1
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: 1.0.1
68
82
  - !ruby/object:Gem::Dependency
69
83
  name: json-schema
70
84
  requirement: !ruby/object:Gem::Requirement