invalid_date:"Enter a date in the correct format, for example 31 1 2022"
invalid_date:"Enter a date in the correct format, for example 31 1 2022"
outside_collection_window:Enter a date within the 22/23 financial year, which is between 1st April 2022 and 31st March 2023
outside_collection_window:Enter a date within the 22/23 collection year, which is between 1st April 2022 and 31st March 2023
postcode:"Enter a postcode in the correct format, for example AA1 1AA"
postcode:"Enter a postcode in the correct format, for example AA1 1AA"
location_admin_district:"Select a local authority"
location_admin_district:"Select a local authority"
email:
email:
@ -155,14 +155,18 @@ en:
intermediate_rent_product_name:
intermediate_rent_product_name:
blank:"Enter name of other intermediate rent product"
blank:"Enter name of other intermediate rent product"
saledate:
saledate:
current_financial_year:
current_collection_year:
Enter a date within the %{current_start_year_short}/%{current_end_year_short} financial year, which is between %{current_start_year_long} and %{current_end_year_long}
Enter a date within the %{current_start_year_short}/%{current_end_year_short} collection year, which is between %{current_start_year_long} and %{current_end_year_long}
previous_and_current_financial_year:
previous_and_current_collection_year:
"Enter a date within the %{previous_start_year_short}/%{previous_end_year_short} or %{previous_end_year_short}/%{current_end_year_short} financial years, which is between %{previous_start_year_long} and %{current_end_year_long}"
"Enter a date within the %{previous_start_year_short}/%{previous_end_year_short} or %{previous_end_year_short}/%{current_end_year_short} collection years, which is between %{previous_start_year_long} and %{current_end_year_long}"
type:
type:
percentage_bought_must_be_at_least_threshold:"The minimum increase in equity while staircasing is %{threshold}% for this shared ownership type"
percentage_bought_must_be_at_least_threshold:"The minimum increase in equity while staircasing is %{threshold}% for this shared ownership type"
startdate:
startdate:
current_collection_year:
Enter a date within the %{current_start_year_short}/%{current_end_year_short} collection year, which is between %{current_start_year_long} and %{current_end_year_long}
previous_and_current_collection_year:
"Enter a date within the %{previous_start_year_short}/%{previous_end_year_short} or %{previous_end_year_short}/%{current_end_year_short} collection years, which is between %{previous_start_year_long} and %{current_end_year_long}"
later_than_14_days_after:"The tenancy start date must not be later than 14 days from today’s date"
later_than_14_days_after:"The tenancy start date must not be later than 14 days from today’s date"
before_scheme_end_date:"The tenancy start date must be before the end date for this supported housing scheme"
before_scheme_end_date:"The tenancy start date must be before the end date for this supported housing scheme"
after_void_date:"Enter a tenancy start date that is after the void date"
after_void_date:"Enter a tenancy start date that is after the void date"
expect(record.errors[:saledate]).toinclude("Enter a date within the 23/24 or 24/25 financial years, which is between 1st April 2023 and 31st March 2025")
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
end
end
context"when saledate is after the 22/23 financial year"do
context"when saledate is after the 22/23 collection year"do
expect(record.errors[:saledate]).toinclude("Enter a date within the 23/24 or 24/25 financial years, which is between 1st April 2023 and 31st March 2025")
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")
it"cannot be before the first collection window start date"do
record.startdate=Time.zone.local(2021,1,1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 21/22 or 22/23 collection years, which is between 1st April 2021 and 31st March 2023")
end
it"cannot be after the second collection window end date"do
record.startdate=Time.zone.local(2023,7,1,6)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 21/22 or 22/23 collection years, which is between 1st April 2021 and 31st March 2023")
it"cannot be before the first collection window start date"do
record.startdate=Time.zone.local(2022,1,1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 22/23 collection year, which is between 1st April 2022 and 31st March 2023")
end
it"cannot be after the second collection window end date"do
record.startdate=Time.zone.local(2023,7,1,6)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 22/23 collection year, which is between 1st April 2022 and 31st March 2023")
it"cannot be before the first collection window start date"do
record.startdate=Time.zone.local(2022,1,1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 22/23 or 23/24 collection years, which is between 1st April 2022 and 31st March 2024")
end
it"cannot be after the second collection window end date"do
record.startdate=Time.zone.local(2024,7,1,6)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).toinclude(match"Enter a date within the 22/23 or 23/24 collection years, which is between 1st April 2022 and 31st March 2024")
it"cannot be before the first collection window start date"do
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 be after the second collection window end date"do
record.startdate=Time.zone.local(2024,7,1,6)
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
end
end
end
describe"#validate_irproduct"do
describe"#validate_irproduct"do
it"adds an error when the intermediate rent product name is not provided but the rent type was given as other intermediate rent product"do
it"adds an error when the intermediate rent product name is not provided but the rent type was given as other intermediate rent product"do