Skip to content

Commit

Permalink
Merge pull request #1110 from alphagov/ab-meta-tag
Browse files Browse the repository at this point in the history
Make A/B test meta tag consistent with Google Analytics JS
  • Loading branch information
tijmenb committed Jan 31, 2017
2 parents c158996 + 43e90de commit 2f1b6a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/views/help/ab_testing.html.erb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<% content_for :title, "A/B testing - GOV.UK" %>
<% content_for :extra_headers do %>
<meta name="robots" content="noindex">
<meta name="govuk:ab-test:Example:current-bucket" content="<%= @ab_variant %>">
<meta name="govuk:ab-test" content="Example:<%= @ab_variant %>">
<% end %>

<main id="content" role="main" class="group">
Expand Down
8 changes: 4 additions & 4 deletions test/functional/help_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,30 @@ class HelpControllerTest < ActionController::TestCase
get :ab_testing

assert_select ".ab-example-group", text: "A"
assert_meta_tag "govuk:ab-test:Example:current-bucket", "A"
assert_meta_tag "govuk:ab-test", "Example:A"
end

should "show the user the 'B' version if the user is in bucket 'A'" do
@request.headers["HTTP_GOVUK_ABTEST_EXAMPLE"] = "B"
get :ab_testing

assert_select ".ab-example-group", text: "B"
assert_meta_tag "govuk:ab-test:Example:current-bucket", "B"
assert_meta_tag "govuk:ab-test", "Example:B"
end

should "show the user the default version if the user is not in a bucket" do
get :ab_testing

assert_select ".ab-example-group", text: "A"
assert_meta_tag "govuk:ab-test:Example:current-bucket", "A"
assert_meta_tag "govuk:ab-test", "Example:A"
end

should "show the user the default version if the user is in an unknown bucket" do
@request.headers["HTTP_GOVUK_ABTEST_EXAMPLE"] = "not_a_valid_AB_test_value"
get :ab_testing

assert_select ".ab-example-group", text: "A"
assert_meta_tag "govuk:ab-test:Example:current-bucket", "A"
assert_meta_tag "govuk:ab-test", "Example:A"
end
end

Expand Down

0 comments on commit 2f1b6a4

Please sign in to comment.