Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make A/B test meta tag consistent with Google Analytics JS #1110

Merged
merged 1 commit into from
Jan 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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