|
|
|
@ -67,6 +67,21 @@ RSpec.describe NavigationItemsHelper do
|
|
|
|
|
expect(primary_items("/account", current_user)).to eq(expected_navigation_items) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the user is on the individual user's page" do |
|
|
|
|
let(:expected_navigation_items) do |
|
|
|
|
[ |
|
|
|
|
NavigationItemsHelper::NavigationItem.new("Logs", "/logs", false), |
|
|
|
|
NavigationItemsHelper::NavigationItem.new("Supported housing", "/supported-housing", false), |
|
|
|
|
NavigationItemsHelper::NavigationItem.new("Users", "/organisations/#{current_user.organisation.id}/users", true), |
|
|
|
|
NavigationItemsHelper::NavigationItem.new("About your organisation", organisation_path, false), |
|
|
|
|
] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns navigation items with the users item set as current" do |
|
|
|
|
expect(primary_items("/users/1", current_user)).to eq(expected_navigation_items) |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the user is a support user" do |
|
|
|
@ -132,6 +147,21 @@ RSpec.describe NavigationItemsHelper do
|
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
context "when the user is on the individual user's page" do |
|
|
|
|
let(:expected_navigation_items) do |
|
|
|
|
[ |
|
|
|
|
NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", false), |
|
|
|
|
NavigationItemsHelper::NavigationItem.new("Users", "/users", true), |
|
|
|
|
NavigationItemsHelper::NavigationItem.new("Logs", "/logs", false), |
|
|
|
|
NavigationItemsHelper::NavigationItem.new("Supported housing", "/supported-housing", false), |
|
|
|
|
] |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
it "returns navigation items with the users item set as current" do |
|
|
|
|
expect(primary_items("/users/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" } |
|
|
|
|