govuk_ab_testing 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5f92347d47df5e991b1a05be1d87635ea828ad6
4
- data.tar.gz: b4e1a666f672b5a06937fbc11480270c2df4c22d
3
+ metadata.gz: 60c87598019b68f5a95ea973ebec062cf6972f81
4
+ data.tar.gz: 6d18e3e60365d2cc471abed1065127a2f277ccf2
5
5
  SHA512:
6
- metadata.gz: cec68a1ce03789b854cf129061f0fd85b73b816b1fbf86877d68142ccdadebf458a24f324f3ce6acd7b19f3a29addb365811299eda58abcb6c71e3fbfdf0366d
7
- data.tar.gz: 6ece6addd993e5a06448b8e02a0db285a91ee4445cb2e0db23d3bf6aa775e88edf788d76ca770591f6137af777f198a8d54081b6bbb8817e519d6a45f0e0743a
6
+ metadata.gz: 763e5aeca3ce16310d2b4923c80722310ee3669c2dccc5d54070075d4d57b06f361f4c324e925e5ac975b166662f0c86e2a25726761e923b5322867f23205545
7
+ data.tar.gz: 3afb6e0ea32979ff411421723b27438dcfce0d55a571fdb6e116b9c8c836ab98e987efca2d21e5c67486a3cf72c22caf417095f30cc6c7fbd6ba85f1502701f6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 1.0.4
2
+
3
+ * Port the individual set-up and assertion steps from Minitest to RSpec
4
+
1
5
  ## 1.0.3
2
6
 
3
7
  * Add more Minitest helpers with more fine-grained assertions
data/README.md CHANGED
@@ -159,8 +159,8 @@ end
159
159
 
160
160
  ##### RSpec
161
161
 
162
- It is also possible to use `with_variant` in RSpec tests. Here is an example of
163
- a spec file:
162
+ It is also possible to use `with_variant` and all the individual setup and
163
+ assertions steps in RSpec tests. Here is an example of a spec file:
164
164
 
165
165
  ```ruby
166
166
  # spec/features/ab_testing_spec.rb
@@ -36,5 +36,32 @@ module GovukAbTesting
36
36
  end
37
37
  end
38
38
  end
39
+
40
+ def setup_ab_variant(ab_test_name, variant, dimension = 300)
41
+ ab_test = GovukAbTesting::AbTest.new(ab_test_name, dimension: dimension)
42
+
43
+ acceptance_test_framework.set_header(ab_test.request_header, variant)
44
+ end
45
+
46
+ def assert_response_is_cached_by_variant(ab_test_name)
47
+ ab_test = GovukAbTesting::AbTest.new(ab_test_name, dimension: 123)
48
+
49
+ vary_header_value = acceptance_test_framework.vary_header
50
+ expect(vary_header_value).to eq(ab_test.response_header)
51
+ end
52
+
53
+ def assert_response_not_modified_for_ab_test
54
+ expect(acceptance_test_framework.vary_header).to be_nil,
55
+ "`Vary` header is being added to a page which should not be modified by the A/B test"
56
+
57
+ assert_page_not_tracked_in_ab_test
58
+ end
59
+
60
+ def assert_page_not_tracked_in_ab_test
61
+ meta_tags = acceptance_test_framework.analytics_meta_tags
62
+
63
+ expect(meta_tags).to be_empty,
64
+ "A/B meta tag is being added to a page which should not be modified by the A/B test"
65
+ end
39
66
  end
40
67
  end
@@ -1,3 +1,3 @@
1
1
  module GovukAbTesting
2
- VERSION = "1.0.3".freeze
2
+ VERSION = "1.0.4".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_ab_testing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-03 00:00:00.000000000 Z
11
+ date: 2017-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake