From 2fb0c1f18a4fc9a18b0d4fbedd0fecead6dd731e Mon Sep 17 00:00:00 2001 From: Murilo Dal Ri Date: Thu, 16 Apr 2020 14:57:15 +0100 Subject: [PATCH] Add different placeholder image for world news Adds a new placeholder image for world news stories. https://govuk.zendesk.com/agent/tickets/3992513 --- app/presenters/content_item/news_image.rb | 6 +++++- test/presenters/content_item/news_image_test.rb | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/presenters/content_item/news_image.rb b/app/presenters/content_item/news_image.rb index 595b7a5ce..7aa3a6cbc 100644 --- a/app/presenters/content_item/news_image.rb +++ b/app/presenters/content_item/news_image.rb @@ -13,7 +13,11 @@ def default_news_image def placeholder_image # this image has been uploaded to asset-manager - { "url" => "https://assets.publishing.service.gov.uk/media/5e59279b86650c53b2cefbfe/placeholder.jpg" } + if content_item.dig("document_type") == "world_news_story" + { "url" => "https://assets.publishing.service.gov.uk/media/5e985599d3bf7f3fc943bbd8/UK_government_logo.jpg" } + else + { "url" => "https://assets.publishing.service.gov.uk/media/5e59279b86650c53b2cefbfe/placeholder.jpg" } + end end end end diff --git a/test/presenters/content_item/news_image_test.rb b/test/presenters/content_item/news_image_test.rb index 070dbd8d7..b79f5e103 100644 --- a/test/presenters/content_item/news_image_test.rb +++ b/test/presenters/content_item/news_image_test.rb @@ -38,4 +38,12 @@ def initialize assert_equal placeholder_image, item.image end + + test "presents a placeholder image if world location news has no image or default news image" do + item = DummyContentItem.new + item.content_item["document_type"] = "world_news_story" + placeholder_image = { "url" => "https://assets.publishing.service.gov.uk/media/5e985599d3bf7f3fc943bbd8/UK_government_logo.jpg" } + + assert_equal placeholder_image, item.image + end end