From b1c881fda0dda4919c51cf46b8035bf9e02ad3e6 Mon Sep 17 00:00:00 2001 From: Nick Colley Date: Fri, 22 Jul 2016 13:38:18 +0100 Subject: [PATCH] Fix breaking tests due to translation additions --- app/views/govuk_component/document_footer.raw.html.erb | 4 ++-- app/views/govuk_component/related_items.raw.html.erb | 7 ++++++- config/locales/en.yml | 1 + test/govuk_component/document_footer_test.rb | 4 ++-- test/govuk_component/related_items_test.rb | 6 +++--- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/app/views/govuk_component/document_footer.raw.html.erb b/app/views/govuk_component/document_footer.raw.html.erb index 97b1cbb15..d91f41c64 100644 --- a/app/views/govuk_component/document_footer.raw.html.erb +++ b/app/views/govuk_component/document_footer.raw.html.erb @@ -22,13 +22,13 @@
<% if local_assigns.include?(:published) && published %>

- <%= t("govuk_component.document_footer.published", default: "Published") %> + <%= t("govuk_component.document_footer.published", default: "Published") %>: <%= published %>

<% end %> <% if local_assigns.include?(:updated) && updated %>

- <%= t("govuk_component.document_footer.updated", default: "Updated") %> + <%= t("govuk_component.document_footer.updated", default: "Updated") %>: <%= updated %>

<% end %> diff --git a/app/views/govuk_component/related_items.raw.html.erb b/app/views/govuk_component/related_items.raw.html.erb index 8f5c20a50..8ac8c812b 100644 --- a/app/views/govuk_component/related_items.raw.html.erb +++ b/app/views/govuk_component/related_items.raw.html.erb @@ -24,7 +24,12 @@ <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index e9c36be4c..f77e281c6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -29,3 +29,4 @@ en: pagination: "Pagination" related_items: more: "More" + in: "in" diff --git a/test/govuk_component/document_footer_test.rb b/test/govuk_component/document_footer_test.rb index 742c8a632..a7a431371 100644 --- a/test/govuk_component/document_footer_test.rb +++ b/test/govuk_component/document_footer_test.rb @@ -63,8 +63,8 @@ def component_name } }) - assert_select 'p', text: 'Published: 20 January 2092' - assert_select 'p', text: 'Updated: 22 January 2092' + assert_select 'p', text: /Published:\s+20 January 2092/ + assert_select 'p', text: /Updated:\s+22 January 2092/ assert_select 'p', text: 'Date opened: 1 February 2092' assert_select 'p', text: 'Date closed: 1 March 2093' end diff --git a/test/govuk_component/related_items_test.rb b/test/govuk_component/related_items_test.rb index 6e5e06bbf..57a6674b6 100644 --- a/test/govuk_component/related_items_test.rb +++ b/test/govuk_component/related_items_test.rb @@ -33,7 +33,7 @@ def component_name }) assert_select "h2", text: "Section title" - assert_link_with_text_in("ul li:last-child", "/more-link", "More in Section title") + assert_link_with_text_in("ul li:last-child", "/more-link", /More\s+in\s+Section title/) assert_link_with_text_in("ul li:first-child", "/item", "Item title") assert_link_with_text_in("ul li:first-child + li", "/other-item", "Other item title") end @@ -65,11 +65,11 @@ def component_name }) assert_select "h2", text: "Section title" - assert_link_with_text_in("ul li:last-child", "/more-link", "More in Section title") + assert_link_with_text_in("ul li:last-child", "/more-link", /More\s+in\s+Section title/) assert_link_with_text_in("ul li:first-child", "/item", "Item title") assert_select "h2", text: "Other section title" - assert_link_with_text_in("ul li:last-child", "/other-more-link", "More in Other section title") + assert_link_with_text_in("ul li:last-child", "/other-more-link", /More\s+in\s+Other section title/) assert_link_with_text_in("ul li:first-child", "/other-item", "Other item title") end