Browse Source

Add test, fix copy order

pull/2086/head
Kat 2 years ago
parent
commit
c05068dcdb
  1. 4
      app/components/missing_stock_owners_banner_component.rb
  2. 19
      spec/requests/lettings_logs_controller_spec.rb

4
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.</br>
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}.</br>
If your organisation does own stock, #{contact_helpdesk_link} to update your details.".html_safe
end
end

19
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

Loading…
Cancel
Save