Skip to content

Commit

Permalink
Add test for switch app link
Browse files Browse the repository at this point in the history
  • Loading branch information
KludgeKML committed Aug 14, 2024
1 parent 7ef5de1 commit e31c702
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
href: services_path,
active: current_page?(services_path),
}

menu_option << {
text: "Switch app",
href: Plek.find("signon"),
}
%>
<%= render "govuk_publishing_components/components/layout_header", {
Expand Down
18 changes: 10 additions & 8 deletions spec/system/main_menu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,29 @@
stub_organisations_api_has_organisations_with_bodies([{ "title" => "Department of Randomness", "details" => { "slug" => "random-department" } }])
end

it "shows only the Services menu item" do
it "shows only the Services/Switch app menu items" do
visit "/"

within(".govuk-header__container") do
expect(page).not_to have_content("Broken Links")
expect(page).not_to have_content("Councils")
expect(page).to have_content("Services")
expect(page).not_to have_link("Broken Links")
expect(page).not_to have_link("Councils")
expect(page).to have_link("Services")
expect(page).to have_link("Switch app")
end
end
end

context "as a GDS Editor" do
before { login_as_gds_editor }

it "shows all three menu options" do
it "shows all four menu options" do
visit "/"

within(".govuk-header__container") do
expect(page).to have_content("Broken Links")
expect(page).to have_content("Councils")
expect(page).to have_content("Services")
expect(page).to have_link("Broken Links")
expect(page).to have_link("Councils")
expect(page).to have_link("Services")
expect(page).to have_link("Switch app")
end
end
end
Expand Down

0 comments on commit e31c702

Please sign in to comment.