From a782a6346d7a1411fc961194754932804dc16bd2 Mon Sep 17 00:00:00 2001 From: JG Date: Tue, 14 Jun 2022 08:11:57 +0100 Subject: [PATCH] tests and code to make sure supported housing is highlighted --- spec/helpers/navigation_items_helper_spec.rb | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/spec/helpers/navigation_items_helper_spec.rb b/spec/helpers/navigation_items_helper_spec.rb index d007b31e2..52ad582c5 100644 --- a/spec/helpers/navigation_items_helper_spec.rb +++ b/spec/helpers/navigation_items_helper_spec.rb @@ -82,6 +82,21 @@ RSpec.describe NavigationItemsHelper do expect(primary_items("/users/1", current_user)).to eq(expected_navigation_items) end end + + context "when the user is on the individual scheme's page" do + let(:expected_navigation_items) do + [ + NavigationItemsHelper::NavigationItem.new("Logs", "/logs", false), + NavigationItemsHelper::NavigationItem.new("Supported housing", "/supported-housing", true), + NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", false), + NavigationItemsHelper::NavigationItem.new("About your organisation", organisation_path, false), + ] + end + + it "returns navigation items with supported housing item set as current" do + expect(primary_items("/supported-housing/1", current_user)).to eq(expected_navigation_items) + end + end end context "when the user is a support user" do @@ -162,6 +177,21 @@ RSpec.describe NavigationItemsHelper do end end + context "when the user is on the individual scheme's page" do + let(:expected_navigation_items) do + [ + NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", false), + NavigationItemsHelper::NavigationItem.new("Users", "/users", false), + NavigationItemsHelper::NavigationItem.new("Logs", "/logs", false), + NavigationItemsHelper::NavigationItem.new("Supported housing", "/supported-housing", true), + ] + end + + it "returns navigation items with supported housing item set as current" do + expect(primary_items("/supported-housing/1", current_user)).to eq(expected_navigation_items) + end + end + context "when the user is on the specific organisation's page" do context "when the user is on organisation logs page" do let(:required_sub_path) { "logs" }