Browse Source

CLDC-1361-only stock owning orgs see schemes in nav bar (#822)

* only stock owning orgs see schemes in nav bar

* lint

* added to organisation factory and fixed tests
pull/829/head
Ted-U 2 years ago committed by GitHub
parent
commit
d56a4e78fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/helpers/navigation_items_helper.rb
  2. 1
      spec/factories/organisation.rb
  3. 22
      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)),

1
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

22
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

Loading…
Cancel
Save