Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Feb 12, 2025
1 parent dd3717b commit 4c38d5f
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 7 deletions.
2 changes: 0 additions & 2 deletions app/models/fatality_notice.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
class FatalityNotice < ContentItem
include Withdrawable

def field_of_operation
content_item_links = content_store_hash["links"]["field_of_operation"]
if content_item_links
Expand Down
2 changes: 1 addition & 1 deletion app/views/fatality_notice/show.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% content_for :title do %>
<%= content_item.title %> - GOV.UK
<%= withdrawable_title(content_item) %> - GOV.UK
<% end %>

<% content_for :extra_headers do %>
Expand Down
46 changes: 42 additions & 4 deletions spec/system/fatality_notice_spec.rb
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

0 comments on commit 4c38d5f

Please sign in to comment.