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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/lib/govuk_ab_testing/rspec_helpers.rb +27 -0
- data/lib/govuk_ab_testing/version.rb +1 -1
- 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: 60c87598019b68f5a95ea973ebec062cf6972f81
|
4
|
+
data.tar.gz: 6d18e3e60365d2cc471abed1065127a2f277ccf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 763e5aeca3ce16310d2b4923c80722310ee3669c2dccc5d54070075d4d57b06f361f4c324e925e5ac975b166662f0c86e2a25726761e923b5322867f23205545
|
7
|
+
data.tar.gz: 3afb6e0ea32979ff411421723b27438dcfce0d55a571fdb6e116b9c8c836ab98e987efca2d21e5c67486a3cf72c22caf417095f30cc6c7fbd6ba85f1502701f6
|
data/CHANGELOG.md
CHANGED
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`
|
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
|
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.
|
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-
|
11
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|