Browse Source

tests and code to make sure supported housing is highlighted

pull/656/head
JG 3 years ago
parent
commit
a782a6346d
  1. 30
      spec/helpers/navigation_items_helper_spec.rb

30
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) expect(primary_items("/users/1", current_user)).to eq(expected_navigation_items)
end end
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 end
context "when the user is a support user" do context "when the user is a support user" do
@ -162,6 +177,21 @@ RSpec.describe NavigationItemsHelper do
end end
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 the specific organisation's page" do
context "when the user is on organisation logs page" do context "when the user is on organisation logs page" do
let(:required_sub_path) { "logs" } let(:required_sub_path) { "logs" }

Loading…
Cancel
Save