Browse Source

Add guidance link

pull/2940/head
Kat 3 months ago
parent
commit
96b5f62f3e
  1. 1
      app/views/logs/edit.html.erb
  2. 15
      spec/requests/lettings_logs_controller_spec.rb
  3. 11
      spec/requests/sales_logs_controller_spec.rb

1
app/views/logs/edit.html.erb

@ -25,6 +25,7 @@
<% end %> <% end %>
</p> </p>
<% elsif @log.status == "not_started" %> <% elsif @log.status == "not_started" %>
<p class="govuk-body"><%= govuk_link_to "Guidance for submitting social housing lettings and sales data (opens in a new tab)", guidance_path, target: "#" %></p>
<p class="govuk-body">This log has not been started.</p> <p class="govuk-body">This log has not been started.</p>
<% elsif @log.status == "completed" %> <% elsif @log.status == "completed" %>
<p class="govuk-body"> <p class="govuk-body">

15
spec/requests/lettings_logs_controller_spec.rb

@ -1155,6 +1155,21 @@ RSpec.describe LettingsLogsController, type: :request do
expect(lettings_log.status).to eq("completed") expect(lettings_log.status).to eq("completed")
expect(page).to have_link("review and make changes to this log", href: "/lettings-logs/#{lettings_log.id}/review") expect(page).to have_link("review and make changes to this log", href: "/lettings-logs/#{lettings_log.id}/review")
end end
it "does not show guidance link" do
expect(page).not_to have_content("Guidance for submitting social housing lettings and sales data (opens in a new tab)")
end
end
context "and the log is not started" do
let(:lettings_log) { create(:lettings_log, status: "not_started", assigned_to: user) }
it "shows guidance link" do
allow(Time.zone).to receive(:now).and_return(lettings_log.form.edit_end_date - 1.day)
get lettings_log_path(lettings_log)
expect(lettings_log.status).to eq("not_started")
expect(page).to have_content("Guidance for submitting social housing lettings and sales data (opens in a new tab)")
end
end end
context "with bulk_upload_id filter" do context "with bulk_upload_id filter" do

11
spec/requests/sales_logs_controller_spec.rb

@ -866,6 +866,7 @@ RSpec.describe SalesLogsController, type: :request do
context "when viewing a sales log" do context "when viewing a sales log" do
let(:headers) { { "Accept" => "text/html" } } let(:headers) { { "Accept" => "text/html" } }
let(:completed_sales_log) { FactoryBot.create(:sales_log, :completed, owning_organisation: user.organisation, assigned_to: user) } let(:completed_sales_log) { FactoryBot.create(:sales_log, :completed, owning_organisation: user.organisation, assigned_to: user) }
let(:not_started_sales_log) { FactoryBot.create(:sales_log, owning_organisation: user.organisation, assigned_to: user) }
before do before do
sign_in user sign_in user
@ -956,6 +957,16 @@ RSpec.describe SalesLogsController, type: :request do
expect(page).to have_content("This log is from the 2021 to 2022 collection window, which is now closed.") expect(page).to have_content("This log is from the 2021 to 2022 collection window, which is now closed.")
end end
end end
it "does not show guidance link" do
get "/sales-logs/#{completed_sales_log.id}", headers:, params: {}
expect(page).not_to have_content("Guidance for submitting social housing lettings and sales data (opens in a new tab)")
end
it "shows guidance link for not_started log" do
get "/sales-logs/#{not_started_sales_log.id}", headers:, params: {}
expect(page).to have_content("Guidance for submitting social housing lettings and sales data (opens in a new tab)")
end
end end
context "when requesting CSV download" do context "when requesting CSV download" do

Loading…
Cancel
Save