Skip to content

Commit f602401

Browse files
committed
Update tests
1 parent b1da197 commit f602401

13 files changed

+19
-18
lines changed

app/views/content_items/document_collection.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<div class="govuk-grid-row">
3131
<div class="govuk-grid-column-two-thirds">
3232
<% if @content_item.important_metadata.any? %>
33-
<%= content_tag :div, class: "inverse-background responsive-bottom-margin" do %>
33+
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
3434
<%= render "govuk_publishing_components/components/metadata", {
3535
inverse: true,
3636
other: @content_item.important_metadata,

app/views/content_items/fatality_notice.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<div class="content-bottom-margin">
2424
<div class="responsive-bottom-margin">
2525
<% if @content_item.important_metadata.any? %>
26-
<%= content_tag :div, class: "inverse-background responsive-bottom-margin" do %>
26+
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
2727
<%= render "govuk_publishing_components/components/metadata", {
2828
inverse: true,
2929
other: @content_item.important_metadata,

app/views/content_items/specialist_document.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<div class="govuk-grid-row">
2323
<div class="govuk-grid-column-two-thirds">
2424
<% if @content_item.important_metadata.any? %>
25-
<%= content_tag :div, class: "inverse-background responsive-bottom-margin" do %>
25+
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
2626
<%= render "govuk_publishing_components/components/metadata", {
2727
inverse: true,
2828
other: @content_item.important_metadata,

app/views/content_items/speech.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<div class="content-bottom-margin">
2626
<div class="responsive-bottom-margin">
2727
<% if @content_item.important_metadata.any? %>
28-
<%= content_tag :div, class: "inverse-background responsive-bottom-margin" do %>
28+
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
2929
<%= render "govuk_publishing_components/components/metadata", {
3030
inverse: true,
3131
other: @content_item.important_metadata,

app/views/content_items/statistical_data_set.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<div class="govuk-grid-row">
2626
<div class="govuk-grid-column-two-thirds">
2727
<% if @content_item.important_metadata.any? %>
28-
<%= content_tag :div, class: "inverse-background responsive-bottom-margin" do %>
28+
<%= content_tag :div, class: "important-metadata inverse-background responsive-bottom-margin" do %>
2929
<%= render "govuk_publishing_components/components/metadata", {
3030
inverse: true,
3131
other: @content_item.important_metadata,

app/views/content_items/statistics_announcement.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="govuk-grid-row">
1717
<div class="govuk-grid-column-two-thirds">
1818
<% if @content_item.important_metadata.any? %>
19-
<%= content_tag :div, class: "inverse-background" do %>
19+
<%= content_tag :div, class: "important-metadata inverse-background" do %>
2020
<%= render "govuk_publishing_components/components/metadata", {
2121
inverse: true,
2222
other: @content_item.important_metadata,

test/integration/fatality_notice_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class FatalityNoticeTest < ActionDispatch::IntegrationTest
2424
from: {
2525
"Ministry of Defence": "/government/organisations/ministry-of-defence",
2626
},
27-
})
27+
}, context_selector: ".metadata-column")
2828

2929
assert_has_important_metadata(
3030
"Field of operation": { "Zululand": "/government/fields-of-operation/zululand" },
@@ -60,7 +60,7 @@ class FatalityNoticeTest < ActionDispatch::IntegrationTest
6060
assert_has_metadata({ from: {
6161
"Ministry of Defence": "/government/organisations/ministry-of-defence",
6262
"The Rt Hon Sir Eric Pickles MP": "/government/people/eric-pickles",
63-
} })
63+
} }, context_selector: ".metadata-column")
6464
end
6565

6666
test "fatality notice with withdrawn notice" do

test/integration/publication_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PublicationTest < ActionDispatch::IntegrationTest
2525
"Environment Agency": "/government/organisations/environment-agency",
2626
"The Rt Hon Sir Eric Pickles MP": "/government/people/eric-pickles",
2727
},
28-
})
28+
}, context_selector: ".metadata-column")
2929

3030
assert_has_structured_data(page, "Article")
3131

test/integration/specialist_document_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class SpecialistDocumentTest < ActionDispatch::IntegrationTest
2424
"Air Accidents Investigation Branch":
2525
"/government/organisations/air-accidents-investigation-branch",
2626
},
27-
})
27+
}, context_selector: ".metadata-column")
2828
end
2929

3030
test "renders published and updated in metadata" do

test/integration/speech_test.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SpeechTest < ActionDispatch::IntegrationTest
2727
"The Rt Hon Andrea Leadsom MP": "/government/people/andrea-leadsom",
2828
},
2929
published: "8 March 2016",
30-
})
30+
}, context_selector: ".metadata-column")
3131

3232
assert_has_important_metadata(
3333
"Delivered on":

test/integration/statistical_data_set_test.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ class StatisticalDataSetTest < ActionDispatch::IntegrationTest
1515
assert_has_metadata({
1616
published: "13 December 2012",
1717
from: { "Department for Transport": "/government/organisations/department-for-transport" },
18-
})
18+
}, context_selector: ".metadata-column")
19+
1920
assert_footer_has_published_dates("Published 13 December 2012")
2021
end
2122

test/integration/statistics_announcement_test.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class StatisticsAnnouncementTest < ActionDispatch::IntegrationTest
1717
assert page.has_text?(@content_item["description"])
1818
assert page.has_css?('img[alt="Accredited official statistics"]')
1919

20-
within ".app-c-important-metadata" do
20+
within ".important-metadata .gem-c-metadata" do
2121
assert page.has_text?(:all, "Release date: January 2016 (provisional)")
2222
end
2323
end
@@ -45,7 +45,7 @@ class StatisticsAnnouncementTest < ActionDispatch::IntegrationTest
4545
assert page.has_text?(@content_item["description"])
4646
assert page.has_text?(:all, "Release date: 20 January 2016 9:30am (confirmed)")
4747

48-
within ".release-date-changed .app-c-important-metadata" do
48+
within ".release-date-changed .gem-c-metadata" do
4949
assert page.has_text?("The release date has been changed")
5050
assert page.has_text?("Previous date")
5151
assert page.has_text?("19 January 2016 9:30am")

test/test_helper.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ def assert_has_publisher_metadata_other(any_args)
105105
assert_has_metadata(any_args)
106106
end
107107

108-
def assert_has_metadata(any_args, extra_metadata_classes: nil)
109-
within ".gem-c-metadata#{extra_metadata_classes}" do
108+
def assert_has_metadata(any_args, context_selector: nil, extra_metadata_classes: nil)
109+
within "#{context_selector} .gem-c-metadata#{extra_metadata_classes}" do
110110
any_args.each_value do |value|
111111
value = { value => nil } if value.is_a?(String)
112112
value.each do |text, href|
@@ -138,9 +138,9 @@ def assert_has_metadata_local(metadata, term_selector, definition_selector)
138138
end
139139

140140
def assert_has_important_metadata(metadata)
141-
within(".app-c-important-metadata") do
141+
within(".important-metadata .gem-c-metadata") do
142142
assert_has_metadata_local(
143-
metadata, ".app-c-important-metadata__term", ".app-c-important-metadata__definition"
143+
metadata, ".gem-c-metadata__term", ".gem-c-metadata__definition"
144144
)
145145
end
146146
end

0 commit comments

Comments
 (0)