diff --git a/app/helpers/navigation_items_helper.rb b/app/helpers/navigation_items_helper.rb index dbaf64296..4bf5a5fec 100644 --- a/app/helpers/navigation_items_helper.rb +++ b/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)), diff --git a/spec/factories/organisation.rb b/spec/factories/organisation.rb index e88abf0c5..5ce6cfc03 100644 --- a/spec/factories/organisation.rb +++ b/spec/factories/organisation.rb @@ -8,6 +8,7 @@ FactoryBot.define do postcode { "SW1P 4DF" } created_at { Time.zone.now } updated_at { Time.zone.now } + holds_own_stock { true } end factory :organisation_la do diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb index ee7ec0c37..07a704913 100644 --- a/spec/features/organisation_spec.rb +++ b/spec/features/organisation_spec.rb @@ -39,6 +39,28 @@ 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 does not hold housing stock" do + before do + organisation.update(holds_own_stock: false) + end + + it "does not show schemes in the navigation bar" do + visit("/logs") + expect(page).not_to have_link("Schemes", href: "/schemes") + end + end + + context "when the user is a coordinator and the organisation holds housing stock" do + before do + organisation.update(holds_own_stock: true) + end + + it "shows schemes in the navigation bar" do + visit("/logs") + expect(page).to have_link("Schemes", href: "/schemes") + end + end end context "when users are part of organisation" do