govuk_ab_testing 0.1.2 → 0.1.3

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: 4d3b5ab50b3ac4b2eba97a72773a26010efd36d3
4
- data.tar.gz: f9fcb6b2cd4b83fd38c7de312a79319976353eda
3
+ metadata.gz: 9ff58dec73e2ed3af500ce0c9f9883ce44366a08
4
+ data.tar.gz: b8ea71471e420af109704ff84476cc00ddcb13f3
5
5
  SHA512:
6
- metadata.gz: b24413b67052c7acd6db7b656c1bec81ef03e865381f5826c490d1d2343be1fc9191c80adcaf240125ba23d61c982f827381f8f88e1086f6ee01ac91c0f29853
7
- data.tar.gz: 908b7618c8ae6adaffaecb80cd9fade61b741ab9be43e2ee82f398840271a868d6383d93ee0a96ca82f9b783a201928cebd221fe5884d6c4c6c4712f41cb7be4
6
+ metadata.gz: 4acc9deda25396e9fe7e5d36af8b38e0aec3c35b7931d937e4b8fd75da39bfda6a110d1ebaf06de78a67c1b2225db2e06d3c49919791dac09a09b432e1cbff97
7
+ data.tar.gz: 72339f5bec3f32c374f0a95f0e73ea8b006e404d8c689719f203958eddd973a1a7b22ce0f27494a53a4b8e2f013991cd69118c9cfd3d2df4420c32c65c4b8fe4
data/README.md CHANGED
@@ -112,8 +112,7 @@ class PartyControllerTest < ActionController::TestCase
112
112
  include GovukAbTesting::MinitestHelpers
113
113
 
114
114
  should "show the original " do
115
- analytics_dimension = 123
116
- setup_ab_variant("your_ab_test_name", "B", analytics_dimension)
115
+ setup_ab_variant("your_ab_test_name", "B") # optionally pass in a analytics dimension as the third argument
117
116
 
118
117
  get :show
119
118
 
@@ -13,16 +13,13 @@ module GovukAbTesting
13
13
  assert_equal ab_test.response_header, response.headers['Vary'], "You probably forgot to use `configure_response`"
14
14
 
15
15
  unless args[:assert_meta_tag] == false
16
- raise "Cannot test the A/B meta tag because no expected :dimension parameter was specified by test" unless args[:dimension]
17
-
18
- assert_meta_tag "govuk:ab-test",
19
- ab_test.meta_tag_name + ':' + requested_variant.variant_name,
20
- args[:dimension],
21
- "You probably forgot to add the `analytics_meta_tag`"
16
+ content = ab_test.meta_tag_name + ':' + requested_variant.variant_name
17
+ message = "You probably forgot to add the `analytics_meta_tag` to the views"
18
+ assert_select "meta[name='govuk:ab-test'][content='#{content}']", 1, message
22
19
  end
23
20
  end
24
21
 
25
- def setup_ab_variant(ab_test_name, variant, dimension)
22
+ def setup_ab_variant(ab_test_name, variant, dimension = 300)
26
23
  ab_test = GovukAbTesting::AbTest.new(ab_test_name, dimension: dimension)
27
24
 
28
25
  @request.headers[ab_test.request_header] = variant
@@ -34,11 +31,5 @@ module GovukAbTesting
34
31
 
35
32
  assert_select "meta[name='govuk:ab-test']", false
36
33
  end
37
-
38
- private
39
-
40
- def assert_meta_tag(name, content, dimension, message)
41
- assert_select "meta[name='#{name}'][content='#{content}'][data-analytics-dimension='#{dimension}']", 1, message
42
- end
43
34
  end
44
35
  end
@@ -1,3 +1,3 @@
1
1
  module GovukAbTesting
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.1.3".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_ab_testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev