-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - add AB test for /find-utr-number
- Loading branch information
1 parent
aea97f6
commit 159f475
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# TEMPORARY (author: richard.towers, expected end date: November 30 2023) | ||
# Content specific AB test for the Find your UTR number page | ||
class AnswerFindYourUtrPresenter < AnswerPresenter | ||
def initialize(parent_presenter, ab_test_variant) | ||
super( | ||
parent_presenter.content_item, | ||
parent_presenter.requested_path, | ||
parent_presenter.view_context | ||
) | ||
@ab_test_variant = ab_test_variant | ||
end | ||
|
||
def body | ||
result = super | ||
if @ab_test_variant == 'VideoLink' | ||
Check failure on line 15 in app/presenters/answer_find_your_utr_presenter.rb GitHub Actions / Lint Ruby / Run RuboCop
|
||
# NOTE: this is a fragile way of doing an AB test on content. | ||
# | ||
# Any change to the base content, or to the way the content is rendered | ||
# could potentially break the B variant of the test, and result in both | ||
# variants being the same. | ||
# We're aware of this risk, and we're going to be careful in this one off | ||
# situation. This is not a sustainable way of doing AB tests in the | ||
# future. | ||
result.sub( | ||
/<li>\s*in\ the\s+<a\ href=\"[^"]*\"><abbr\ title=\"[^"]+\">HMRC<\/abbr>\s+app<\/a>/, | ||
Check failure on line 25 in app/presenters/answer_find_your_utr_presenter.rb GitHub Actions / Lint Ruby / Run RuboCop
Check failure on line 25 in app/presenters/answer_find_your_utr_presenter.rb GitHub Actions / Lint Ruby / Run RuboCop
|
||
'<li>in the <a href="https://www.gov.uk/guidance/download-the-hmrc-app"><abbr title="HM Revenue and Customs">HMRC</abbr> app</a> - watch a <a href="https://www.youtube.com/watch?v=LXw9ily9rTo">video about finding your UTR number in the app</a>' | ||
) | ||
else | ||
result | ||
end | ||
end | ||
end |