diff --git a/app/components/missing_stock_owners_banner_component.rb b/app/components/missing_stock_owners_banner_component.rb index c0cc731d4..6f224c761 100644 --- a/app/components/missing_stock_owners_banner_component.rb +++ b/app/components/missing_stock_owners_banner_component.rb @@ -29,8 +29,8 @@ class MissingStockOwnersBannerComponent < ViewComponent::Base if user.data_coordinator? "If your organisation does own stock, #{contact_helpdesk_link} to update your details.".html_safe else - "If your organisation does own stock, #{contact_helpdesk_link} to update your details.
- Ask a data coordinator to add a stock owner. Find your data coordinators on the #{users_link}.".html_safe + "Ask a data coordinator to add a stock owner. Find your data coordinators on the #{users_link}.
+ If your organisation does own stock, #{contact_helpdesk_link} to update your details.".html_safe end end diff --git a/spec/requests/lettings_logs_controller_spec.rb b/spec/requests/lettings_logs_controller_spec.rb index 661b85fd7..101b52c70 100644 --- a/spec/requests/lettings_logs_controller_spec.rb +++ b/spec/requests/lettings_logs_controller_spec.rb @@ -326,6 +326,25 @@ RSpec.describe LettingsLogsController, type: :request do end end end + + context "and organisation owns stock" do + before do + organisation.update!(holds_own_stock: true) + end + + it "displays button to create a new log" do + get "/lettings-logs" + expect(page).to have_content("Create a new lettings log") + end + + it "does not display the missing stock owners banner" do + get "/lettings-logs", headers:, params: {} + expect(page).not_to have_css(".govuk-notification-banner") + expect(page).not_to have_content("Your organisation does not own stock.") + expect(page).not_to have_link("add a stock owner", href: /stock-owners\/add/) + expect(page).not_to have_link("users page", href: /users/) + end + end end context "when the user is a customer support user" do