Browse Source

do not allow the aswers from previous collection windows to be changed

pull/1044/head
Kat 4 years ago
parent
commit
e2b47d4b24
  1. 12
      app/components/check_answers_summary_list_card_component.html.erb
  2. 12
      app/views/form/_check_answers_summary_list.html.erb
  3. 11
      spec/requests/lettings_logs_controller_spec.rb

12
app/components/check_answers_summary_list_card_component.html.erb

@ -25,11 +25,13 @@
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span> <span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span>
<% end %> <% end %>
<% end %> <% end %>
<% row.action( <% if @log.form.end_date > Time.zone.today %>
text: question.action_text(log), <% row.action(
href: question.action_href(log, question.page.id), text: question.action_text(log),
visually_hidden_text: question.check_answer_label.to_s.downcase, href: question.action_href(log, question.page.id),
) %> visually_hidden_text: question.check_answer_label.to_s.downcase,
) %>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

12
app/views/form/_check_answers_summary_list.html.erb

@ -13,11 +13,13 @@
<span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span> <span class="govuk-!-font-weight-regular app-!-colour-muted"><%= inferred_answer %></span>
<% end %> <% end %>
<% end %> <% end %>
<% row.action( <% if @log.form.end_date > Time.zone.today %>
text: question.action_text(@log), <% row.action(
href: question.action_href(@log, question.page.id), text: question.action_text(@log),
visually_hidden_text: question.check_answer_label.to_s.downcase, href: question.action_href(@log, question.page.id),
) %> visually_hidden_text: question.check_answer_label.to_s.downcase,
) %>
<% end %>
<% end %> <% end %>
<% end %> <% end %>
<% end %> <% end %>

11
spec/requests/lettings_logs_controller_spec.rb

@ -738,6 +738,7 @@ RSpec.describe LettingsLogsController, type: :request do
postcode_known: "No") postcode_known: "No")
end end
let(:id) { postcode_lettings_log.id } let(:id) { postcode_lettings_log.id }
let(:completed_lettings_log) { FactoryBot.create(:lettings_log, :completed, owning_organisation: user.organisation, managing_organisation: user.organisation, created_by: user, startdate: Time.zone.local(2021, 4, 1)) }
before do before do
stub_request(:get, /api.postcodes.io/) stub_request(:get, /api.postcodes.io/)
@ -771,6 +772,16 @@ RSpec.describe LettingsLogsController, type: :request do
get "/lettings-logs/#{id}/income-and-benefits/check-answers" get "/lettings-logs/#{id}/income-and-benefits/check-answers"
expect(CGI.unescape_html(response.body)).to include("You didn’t answer this question") expect(CGI.unescape_html(response.body)).to include("You didn’t answer this question")
end end
it "does not allow you to change the answers for previous collection year logs" do
get "/lettings-logs/#{completed_lettings_log.id}/setup/check-answers", headers: { "Accept" => "text/html" }, params: {}
expect(page).not_to have_link("Change")
expect(page).not_to have_link("Answer")
get "/lettings-logs/#{completed_lettings_log.id}/income-and-benefits/check-answers", headers: { "Accept" => "text/html" }, params: {}
expect(page).not_to have_link("Change")
expect(page).not_to have_link("Answer")
end
end end
context "when requesting CSV download" do context "when requesting CSV download" do

Loading…
Cancel
Save