Skip to content

Commit

Permalink
Set history banner title from government in the links hash
Browse files Browse the repository at this point in the history
Instead of using the government in the details hash which we are
deprecating.
  • Loading branch information
Bevan Loon committed Dec 3, 2019
1 parent 6d4985e commit fb1d4a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion app/presenters/content_item/political.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ def historically_political?
end

def publishing_government
content_item["details"]["government"]["title"]
content_item.dig(
"links", "government", 0, "title"
)
end

private
Expand Down
2 changes: 1 addition & 1 deletion test/presenters/publication_presenter_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def schema_name
end

test "presents the title of the publishing government" do
assert_equal schema_item["details"]["government"]["title"], presented_item.publishing_government
assert_equal schema_item["links"]["government"][0]["title"], presented_item.publishing_government
end

test "content can be historically political" do
Expand Down

0 comments on commit fb1d4a9

Please sign in to comment.