-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
7 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
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 |
---|---|---|
@@ -1,18 +1,56 @@ | ||
RSpec.describe "Fatality Notice" do | ||
before do | ||
content_store_has_example_item("/government/fatalities/sad-news", schema: :fatality_notice) | ||
content_store_has_example_item("/government/fatalities/sir-george-pomeroy-colley", schema: :fatality_notice) | ||
end | ||
|
||
it_behaves_like "it has meta tags", "fatality_notice", "fatality_notice" | ||
|
||
context "when visiting a fatality notice" do | ||
it "displays the fatality notice page" do | ||
visit "/government/fatalities/sad-news" | ||
context "with a default fatality notice" do | ||
before { visit "/government/fatalities/sir-george-pomeroy-colley" } | ||
|
||
it "has a title" do | ||
expect(page).to have_title("Sir George Pomeroy Colley killed in Boer War - GOV.UK") | ||
end | ||
|
||
it "has a heading" do | ||
expect(page).to have_css("h1", text: "Sir George Pomeroy Colley killed in Boer War") | ||
end | ||
|
||
it "has body text" do | ||
expect(page).to have_text("It is with great sadness that the Ministry of Defence must confirm that Sir George Pomeroy Colley, died in battle in Zululand on 27 February 1881") | ||
end | ||
|
||
it "has a field of operation" do | ||
expect(page).to have_text("Field of operation: Zululand") | ||
end | ||
end | ||
|
||
context "when the fatality notice has a minister" do | ||
before do | ||
content_store_has_example_item("/government/fatalities/sir-george-pomeroy-colley", schema: :fatality_notice, example: :fatality_notice_with_minister) | ||
visit "/government/fatalities/sir-george-pomeroy-colley" | ||
end | ||
|
||
it "mentions the minister in the metadata" do | ||
expect(page).to have_text("The Rt Hon Sir Eric Pickles MP") | ||
end | ||
end | ||
|
||
context "when the fatality notice is withdrawn" do | ||
before do | ||
content_store_has_example_item("/government/fatalities/sir-george-pomeroy-colley", schema: :fatality_notice, example: :withdrawn_fatality_notice) | ||
visit "/government/fatalities/sir-george-pomeroy-colley" | ||
end | ||
|
||
it "has withdrawn text on the title" do | ||
expect(page).to have_title("[Withdrawn] Sir George Pomeroy Colley killed in Boer War - GOV.UK") | ||
end | ||
|
||
it "has a withdrawn notice" do | ||
within ".gem-c-notice" do | ||
expect(page).to have_text("This fatality notice was withdrawn on 14 September 2016") | ||
expect(page).to have_text("This content is not factually correct. For current information please go to") | ||
end | ||
end | ||
end | ||
end |