Browse Source

only stock owning orgs see schemes in nav bar

pull/822/head
Ted-U 3 years ago
parent
commit
b2210d3107
  1. 2
      app/helpers/navigation_items_helper.rb
  2. 15
      spec/features/organisation_spec.rb

2
app/helpers/navigation_items_helper.rb

@ -9,7 +9,7 @@ module NavigationItemsHelper
NavigationItem.new("Logs", case_logs_path, logs_current?(path)),
NavigationItem.new("Schemes", "/schemes", supported_housing_schemes_current?(path)),
]
elsif current_user.data_coordinator?
elsif current_user.data_coordinator? && current_user.organisation.holds_own_stock?
[
NavigationItem.new("Logs", case_logs_path, logs_current?(path)),
NavigationItem.new("Schemes", "/schemes", subnav_supported_housing_schemes_path?(path)),

15
spec/features/organisation_spec.rb

@ -39,6 +39,21 @@ RSpec.describe "User Features" do
click_link("About your organisation")
expect(page).to have_current_path("/organisations/#{org_id}/details")
end
context "when the user is a coordinator and the organisation holds housing stock" do
let(:organisation) { FactoryBot.create(:organisation, holds_own_stock: true) }
it "shows schemes in the navigation bar" do
visit("/logs")
expect(page).to have_link("Schemes", href: "/schemes")
end
end
context "when the user is a coordinator and the organisation does not hold housing stock" do
let(:organisation) { FactoryBot.create(:organisation, holds_own_stock: false) }
it "does not show schemes in the navigation bar" do
visit("/logs")
expect(page).to_not have_link("Schemes", href: "/schemes")
end
end
end
context "when users are part of organisation" do

Loading…
Cancel
Save