Browse Source

Update some more tests

pull/2628/head
Kat 2 years ago
parent
commit
70fd9785f6
  1. 2
      spec/models/form/lettings/questions/declaration_spec.rb
  2. 4
      spec/models/form/sales/questions/privacy_notice_spec.rb
  3. 4
      spec/models/location_deactivation_period_spec.rb
  4. 4
      spec/models/notification_spec.rb
  5. 4
      spec/models/validations/sales/sale_information_validations_spec.rb
  6. 2
      spec/models/validations/setup_validations_spec.rb
  7. 4
      spec/models/validations/shared_validations_spec.rb

2
spec/models/form/lettings/questions/declaration_spec.rb

@ -50,7 +50,7 @@ RSpec.describe Form::Lettings::Questions::Declaration, type: :model do
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"declaration" => { "value" => "The tenant has seen the MHCLG privacy notice." },
"declaration" => { "value" => "The tenant has seen the MHCLG privacy notice" },
})
end

4
spec/models/form/sales/questions/privacy_notice_spec.rb

@ -91,7 +91,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
context "and there is a single buyer" do
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"privacynotice" => { "value" => "The buyer has seen or been given access to the MHCLG privacy notice." },
"privacynotice" => { "value" => "The buyer has seen or been given access to the MHCLG privacy notice" },
})
end
@ -109,7 +109,7 @@ RSpec.describe Form::Sales::Questions::PrivacyNotice, type: :model do
it "has the correct answer_options" do
expect(question.answer_options).to eq({
"privacynotice" => { "value" => "The buyers have seen or been given access to the MHCLG privacy notice." },
"privacynotice" => { "value" => "The buyers have seen or been given access to the MHCLG privacy notice" },
})
end

4
spec/models/location_deactivation_period_spec.rb

@ -23,7 +23,7 @@ RSpec.describe LocationDeactivationPeriod do
record.deactivation_date = current_collection_start_date - 1.year
location.location_deactivation_periods.clear
validator.validate(record)
expect(record.errors[:deactivation_date]).to include "The date must be on or after the 1 April 2023"
expect(record.errors[:deactivation_date]).to include "The date must be on or after the 1 April 2023."
end
end
@ -47,7 +47,7 @@ RSpec.describe LocationDeactivationPeriod do
record.deactivation_date = previous_collection_start_date - 2.years
location.location_deactivation_periods.clear
validator.validate(record)
expect(record.errors[:deactivation_date]).to include "The date must be on or after the 1 April 2022"
expect(record.errors[:deactivation_date]).to include "The date must be on or after the 1 April 2022."
end
end

4
spec/models/notification_spec.rb

@ -9,7 +9,7 @@ RSpec.describe Notification, type: :model do
it "adds an error to page_content" do
notification.valid?
expect(notification.errors[:page_content]).to include("Enter the page content")
expect(notification.errors[:page_content]).to include("Enter the page content.")
end
end
@ -19,7 +19,7 @@ RSpec.describe Notification, type: :model do
it "adds an error to link_text" do
notification.valid?
expect(notification.errors[:link_text]).to include("Enter the link text")
expect(notification.errors[:link_text]).to include("Enter the link text.")
end
end
end

4
spec/models/validations/sales/sale_information_validations_spec.rb

@ -671,7 +671,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
it "adds an error" do
sale_information_validator.validate_grant_amount(record)
expect(record.errors[:grant]).to include("Loan, grants or subsidies must be between £9,000 and £16,000")
expect(record.errors[:grant]).to include("Loan, grants or subsidies must be between £9,000 and £16,000.")
end
end
@ -681,7 +681,7 @@ RSpec.describe Validations::Sales::SaleInformationValidations do
it "adds an error" do
sale_information_validator.validate_grant_amount(record)
expect(record.errors[:grant]).to include("Loan, grants or subsidies must be between £9,000 and £16,000")
expect(record.errors[:grant]).to include("Loan, grants or subsidies must be between £9,000 and £16,000.")
end
end

2
spec/models/validations/setup_validations_spec.rb

@ -157,7 +157,7 @@ RSpec.describe Validations::SetupValidations do
record.startdate = Time.zone.local(2024, 4, 1)
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"].length).to be >= 2
expect(record.errors["startdate"][0]).to eq("Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024")
expect(record.errors["startdate"][0]).to eq("Enter a date within the 23/24 collection year, which is between 1st April 2023 and 31st March 2024.")
expect(record.errors["startdate"][1]).to eq(I18n.t("validations.setup.startdate.later_than_14_days_after"))
end
end

4
spec/models/validations/shared_validations_spec.rb

@ -75,14 +75,14 @@ RSpec.describe Validations::SharedValidations do
sales_log.details_known_2 = 1
sales_log.age2 = 130
shared_validator.validate_numeric_min_max(sales_log)
expect(sales_log.errors["age2"].first).to eq("Person 2’s age must be between 0 and 110")
expect(sales_log.errors["age2"].first).to eq("Person 2’s age must be between 0 and 110.")
end
it "validates that buyer 2's age is between 0 and 110 for joint purchase" do
sales_log.jointpur = 1
sales_log.age2 = 130
shared_validator.validate_numeric_min_max(sales_log)
expect(sales_log.errors["age2"].first).to eq("Buyer 2’s age must be between 16 and 110")
expect(sales_log.errors["age2"].first).to eq("Buyer 2’s age must be between 16 and 110.")
end
end
end

Loading…
Cancel
Save