eeny-meeny 2.1.0 → 2.1.1

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: 3d6f1ff00ff903e788dcf59c336dce5748f18852
4
- data.tar.gz: 153b807882e56f14e0865d3b9648e2b3aea747f4
3
+ metadata.gz: 4599a9361b4a7d72a01d42b9b992b3f2578ead2e
4
+ data.tar.gz: 43fbfdad8d15903e61717a2575da3c18c8063321
5
5
  SHA512:
6
- metadata.gz: 977ead352b9f734e1ac1af86f0c6c5649ff68f8e1accac7efe159b6bd1a17a26bf397efbcce7b6c1b47c14650a24944fc87ab7956094ce105147351fcd03f5f1
7
- data.tar.gz: 02e9d69b318010e3fab99e947699d78b053245a1089b871f615a0e05c3ec7f26d58aa1b4a9c37ab72339de7ed7567f51a59e6d93ad29d7c064a355aef83d0b86
6
+ metadata.gz: 1037418a1485bd6bac1754280ff70230d600e23014b11ca97bf063bada61d548ffda7d4dd98fce93ec6ba8f457a2e2c6cb04d021ee45bab314b68f533b2fb80f
7
+ data.tar.gz: 281d612ec907b728eab11f6d9621b22962e27715c112d41a0de8262107d7bca6edf2f945d85047bfa740a716c93e25bb5fa6994adf800d276852bb418b6e0448
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 2.1.1 (2016-10-06)
2
+
3
+ Bugfixes:
4
+
5
+ - Fix bug in `participates_in?` helper that prevented it from working when the `variation_id` was sent as a symbol.
6
+ - Fix bug in `EenyMeeny::ExperimentConstraint` that prevented it from working when the `variation_id` was sent as a symbol.
7
+
1
8
  ### 2.1.0 (2016-10-02)
2
9
 
3
10
  Features:
data/eeny-meeny.gemspec CHANGED
@@ -3,7 +3,7 @@ require File.expand_path('../lib/eeny-meeny/version', __FILE__)
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'eeny-meeny'
5
5
  s.version = EenyMeeny::VERSION.dup
6
- s.date = '2016-10-02'
6
+ s.date = '2016-10-06'
7
7
  s.summary = "A simple split and smoke testing tool for Rails"
8
8
  s.authors = ["Christian Orthmann"]
9
9
  s.email = 'christian.orthmann@gmail.com'
@@ -7,7 +7,7 @@ module EenyMeeny::ExperimentHelper
7
7
  experiment = EenyMeeny::Experiment.find_by_id(experiment_id)
8
8
  return unless !experiment.nil? && experiment.active?
9
9
  participant_variation_id = read_cookie(EenyMeeny::Cookie.cookie_name(experiment))
10
- return if variation_id && variation_id != participant_variation_id
10
+ return if variation_id && variation_id.to_s != participant_variation_id
11
11
  experiment.find_variation(participant_variation_id)
12
12
  end
13
13
 
@@ -13,7 +13,7 @@ module EenyMeeny
13
13
  return false unless !@experiment.nil? && @experiment.active?
14
14
  participant_variation_id = EenyMeeny::Cookie.read(request.cookie_jar[EenyMeeny::Cookie.cookie_name(@experiment)])
15
15
  return false if participant_variation_id.nil? # Not participating in experiment
16
- (@variation_id.nil? || @variation_id == participant_variation_id)
16
+ (@variation_id.nil? || @variation_id.to_s == participant_variation_id)
17
17
  end
18
18
  end
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module EenyMeeny
2
- VERSION = '2.1.0'
2
+ VERSION = '2.1.1'
3
3
  end
@@ -29,6 +29,29 @@ describe EenyMeeny::ExperimentHelper, experiments: true do
29
29
  allow(subject).to receive(:cookies).and_return(request_with_cookie.cookie_jar)
30
30
  expect(subject.participates_in?(:my_page)).to be_a EenyMeeny::Variation
31
31
  end
32
+
33
+ context 'and given a variation id' do
34
+ let(:request_with_variation_cookie) do
35
+ request.set_cookie(EenyMeeny::Cookie.create_for_experiment_variation(EenyMeeny::Experiment.find_by_id(:my_page), variation_id: :new).to_s)
36
+ request
37
+ end
38
+
39
+ context 'that matches the variation id the cookie' do
40
+ it "returns the user's experiment variation" do
41
+ allow(subject).to receive(:cookies).and_return(request_with_cookie.cookie_jar)
42
+ expect(subject.participates_in?(:my_page, variation_id: :new)).to be_a EenyMeeny::Variation
43
+ expect(subject.participates_in?(:my_page, variation_id: 'new')).to be_a EenyMeeny::Variation
44
+ end
45
+ end
46
+
47
+ context 'that does not match the variation id the cookie' do
48
+ it 'returns nil' do
49
+ allow(subject).to receive(:cookies).and_return(request_with_cookie.cookie_jar)
50
+ expect(subject.participates_in?(:my_page, variation_id: :old)).to be_nil
51
+ expect(subject.participates_in?(:my_page, variation_id: 'old')).to be_nil
52
+ end
53
+ end
54
+ end
32
55
  end
33
56
 
34
57
  context 'without an experiment cookie' do
@@ -6,7 +6,7 @@ describe EenyMeeny::ExperimentConstraint, experiments: true do
6
6
 
7
7
  let(:request) do
8
8
  session = Rack::MockSession.new(EenyMeeny::Middleware.new(MockRackApp.new))
9
- session.set_cookie('eeny_meeny_my_page_v1=IlI%2FGW9IZvayAGQbBOroxIrfr6Z116OJqdjFdrw6FOZXOrinmxQmsKw2a%2Fb8kJFP0Up%2BLr4FACovT9%2Bo0hRdcY0AJtcYqMXC96GDMSwa2HauZbjHw16Q3%2BboSnWjfaEOHmqlyxtPxQwxlr3rsT%2FYblPjqqQ%2FiPbaJUqou3LiMtpVg4V%2FJxJdhn0XJUgFMDaFWXVFYYA6VmJSFUGglhRlbg%3D%3D; path=/; expires=Tue, 11 Oct 2016 13:07:53 -0000; HttpOnly')
9
+ session.set_cookie('eeny_meeny_my_page_v1=ctRsrHCj21pZt%2FELsjedHRT9GkYOuIdoTwEyP9kxfI7dDS4I9g1nv77j9Umij1P44SCU7Zebdb8mqwLabTrskg%3D%3D; path=/; expires=Sun, 06 Nov 2016 11:26:01 -0000; HttpOnly')
10
10
  session
11
11
  end
12
12
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eeny-meeny
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Orthmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-02 00:00:00.000000000 Z
11
+ date: 2016-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake