Browse Source

fixed failing specs

pull/648/head
JG 3 years ago
parent
commit
898e8f330c
  1. 5
      app/helpers/navigation_items_helper.rb
  2. 5
      spec/helpers/navigation_items_helper_spec.rb

5
app/helpers/navigation_items_helper.rb

@ -7,6 +7,7 @@ module NavigationItemsHelper
NavigationItem.new("Organisations", organisations_path, organisations_current?(path)),
NavigationItem.new("Users", "/users", users_current?(path)),
NavigationItem.new("Logs", case_logs_path, logs_current?(path)),
NavigationItem.new("Supported housing", "/supported-housing", supported_housing_current?(path)),
]
else
[
@ -35,6 +36,10 @@ private
path == "/users"
end
def supported_housing_current?(path)
path == "/supported-housing"
end
def organisations_current?(path)
path == "/organisations" || subnav_users_path?(path) || subnav_logs_path?(path) || subnav_details_path?(path)
end

5
spec/helpers/navigation_items_helper_spec.rb

@ -110,7 +110,7 @@ RSpec.describe NavigationItemsHelper do
end
it "returns navigation items with the users item set as current" do
expect(primary_items("/logs", current_user)).to eq(expected_navigation_items)
expect(primary_items("/supported-housing", current_user)).to eq(expected_navigation_items)
end
end
@ -122,6 +122,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", true),
NavigationItemsHelper::NavigationItem.new("Users", "/users", false),
NavigationItemsHelper::NavigationItem.new("Logs", "/logs", false),
NavigationItemsHelper::NavigationItem.new("Supported housing", "/supported-housing", false),
]
end
@ -146,6 +147,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", true),
NavigationItemsHelper::NavigationItem.new("Users", "/users", false),
NavigationItemsHelper::NavigationItem.new("Logs", "/logs", false),
NavigationItemsHelper::NavigationItem.new("Supported housing", "/supported-housing", false),
]
end
@ -170,6 +172,7 @@ RSpec.describe NavigationItemsHelper do
NavigationItemsHelper::NavigationItem.new("Organisations", "/organisations", true),
NavigationItemsHelper::NavigationItem.new("Users", "/users", false),
NavigationItemsHelper::NavigationItem.new("Logs", "/logs", false),
NavigationItemsHelper::NavigationItem.new("Supported housing", "/supported-housing", false),
]
end

Loading…
Cancel
Save