Skip to content

Commit

Permalink
Merge pull request #9135 from alphagov/blank-ministers-links
Browse files Browse the repository at this point in the history
Empty ministerial links when reshuffle mode is on
  • Loading branch information
brucebolt authored Jun 11, 2024
2 parents 7af0244 + ea45308 commit d126cbd
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
35 changes: 23 additions & 12 deletions app/presenters/publishing_api/ministers_index_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,29 @@ def content
end

def links
return {} if reshuffle_in_progress?

{
ordered_cabinet_ministers: ordered_cabinet_ministers_content_ids,
ordered_also_attends_cabinet: ordered_also_attends_cabinet_content_ids,
ordered_ministerial_departments: ordered_ministerial_departments_content_ids,
ordered_house_of_commons_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::WhipsHouseOfCommons),
ordered_junior_lords_of_the_treasury_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::JuniorLordsoftheTreasury),
ordered_assistant_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::AssistantWhips),
ordered_house_lords_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::WhipsHouseofLords),
ordered_baronesses_and_lords_in_waiting_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::BaronessAndLordsInWaiting),
}
if reshuffle_in_progress?
{
ordered_cabinet_ministers: [],
ordered_also_attends_cabinet: [],
ordered_ministerial_departments: [],
ordered_house_of_commons_whips: [],
ordered_junior_lords_of_the_treasury_whips: [],
ordered_assistant_whips: [],
ordered_house_lords_whips: [],
ordered_baronesses_and_lords_in_waiting_whips: [],
}
else
{
ordered_cabinet_ministers: ordered_cabinet_ministers_content_ids,
ordered_also_attends_cabinet: ordered_also_attends_cabinet_content_ids,
ordered_ministerial_departments: ordered_ministerial_departments_content_ids,
ordered_house_of_commons_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::WhipsHouseOfCommons),
ordered_junior_lords_of_the_treasury_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::JuniorLordsoftheTreasury),
ordered_assistant_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::AssistantWhips),
ordered_house_lords_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::WhipsHouseofLords),
ordered_baronesses_and_lords_in_waiting_whips: ordered_whips_content_ids(Whitehall::WhipOrganisation::BaronessAndLordsInWaiting),
}
end
end

def title
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,16 @@ def presented_item
},
}

expected_links = {}
expected_links = {
ordered_cabinet_ministers: [],
ordered_also_attends_cabinet: [],
ordered_ministerial_departments: [],
ordered_house_of_commons_whips: [],
ordered_junior_lords_of_the_treasury_whips: [],
ordered_assistant_whips: [],
ordered_house_lords_whips: [],
ordered_baronesses_and_lords_in_waiting_whips: [],
}

assert_equal expected_details, presented_item.content[:details]
assert_valid_against_publisher_schema(presented_item.content, "ministers_index")
Expand Down

0 comments on commit d126cbd

Please sign in to comment.