flash[:notice]="You have successfully updated #{@page.questions.map(&:check_answer_label).first.downcase}"ifprevious_interruption_screen_page_id.present?
flash[:notice]="You have successfully updated #{@page.questions.map(&:check_answer_label).reject{|label|label.to_s.empty?}.first&.downcase}"ifprevious_interruption_screen_page_id.present?
over_soft_max_for_la_combined:"You told us the combined income of this household is %{combined_income}. This seems high. Are you sure this is correct?"
rent:
outside_range_title:"You told us the rent is %{brent}"
min_hint_text:"The minimum rent expected for this type of property in this local authority is %{soft_min_for_period}."
max_hint_text:"The maximum rent expected for this type of property in this local authority is %{soft_max_for_period}."
informative_text:"This is %{higher_or_lower} than we would expect."
hint_text:"Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>"
purchase_price:
title_text:"You told us the purchase price is %{value}"
hint_text:"This is %{higher_or_lower} than we would expect"
@ -13,5 +13,5 @@ Also, if incorrect data is found during QA process, data providers might be aske
To accommodate the different end dates, we will now store 3 different dates on the form definition:
- Submission deadline (submission_deadline) - this is the date displayed at the top of a completed log in lettings and sales - "You can review and make changes to this log until 9 June 2024.". Nothing happens on this date
- New logs end date (end_date) - no new logs for that collection year can be submitted, but logs can be edited
- New logs end date (new_logs_end_date) - no new logs for that collection year can be submitted, but logs can be edited
- Edit and delete logs end date (edit_end_date) - logs can no longer be edited or deleted. Completed logs can still be viewed. Materials / references to the collection year are removed.
expect(question.hint_text).toeq("Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>")
expect(question.hint_text).toeq("Check the following:<ul class=\"govuk-body-l app-panel--interruption\"><li>the decimal point</li><li>the frequency, for example every week or every calendar month</li><li>the rent type is correct, for example affordable or social rent</li></ul>")
@ -105,6 +105,52 @@ RSpec.describe Validations::Sales::SetupValidations do
expect(record.errors[:saledate]).toinclude("Enter a date within the 23/24 or 24/25 collection years, which is between 1st April 2023 and 31st March 2025")
end
end
context"when current time is after the new logs end date but before edit end date for the previous period"do
expect(record.errors["saledate"]).not_toinclude(match"Enter a date within the 24/25 collection year, which is between 1st April 2024 and 31st March 2025")
end
end
context"when after the new logs end date and after the edit end date for the previous period"do
@ -85,6 +85,48 @@ RSpec.describe Validations::SetupValidations do
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024")
end
end
context"when after the new logs end date but before edit end date for the previous period"do
it"cannot create new logs for the previous collection year"do
record.update!(startdate:nil)
record.startdate=Time.zone.local(2023,1,1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024")
end
xit"can edit already created logs for the previous collection year"do
record.startdate=Time.zone.local(2023,1,2)
record.save!(validate:false)
record.startdate=Time.zone.local(2023,1,1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).not_toinclude(match"Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024")
end
end
context"when after the new logs end date and after the edit end date for the previous period"do
it"cannot create new logs for the previous collection year"do
record.update!(startdate:nil)
record.startdate=Time.zone.local(2023,1,1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024")
end
it"cannot edit already created logs for the previous collection year"do
record.startdate=Time.zone.local(2023,1,2)
record.save!(validate:false)
record.startdate=Time.zone.local(2023,1,1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024")
expect(parser.errors.where(:field_128,category::soft_validation).first.message).toeql("You told us the rent is £120.00 every week. The maximum rent expected for this type of property in this local authority is ££118.85 every week.")
expect(parser.errors.where(:field_128,category::soft_validation).first.message).toeql("You told us the rent is £120.00 every week. This is higher than we would expect.")