Browse Source

CLDC-3499: Lint

CLDC-3499-remove-pre-2025-tests
samyou-softwire 1 week ago
parent
commit
fd10147e14
  1. 2
      spec/components/check_answers_summary_list_card_component_spec.rb
  2. 2
      spec/features/form/validations_spec.rb
  3. 12
      spec/models/lettings_log_spec.rb
  4. 2
      spec/models/validations/setup_validations_spec.rb
  5. 4
      spec/models/validations/soft_validations_spec.rb
  6. 37
      spec/requests/sales_logs_controller_spec.rb

2
spec/components/check_answers_summary_list_card_component_spec.rb

@ -1,8 +1,6 @@
require "rails_helper"
RSpec.describe CheckAnswersSummaryListCardComponent, type: :component do
include CollectionTimeHelper
subject(:component) { described_class.new(questions:, log:, user:) }
let(:rendered) { render_inline(component) }

2
spec/features/form/validations_spec.rb

@ -11,7 +11,7 @@ RSpec.describe "validations" do
renewal: 0,
first_time_property_let_as_social_housing: 0,
unitletas: 1,
rsnvac: 9
rsnvac: 9,
)
end
let(:id) { lettings_log.id }

12
spec/models/lettings_log_spec.rb

@ -1972,8 +1972,8 @@ RSpec.describe LettingsLog do
it "returns the log as a duplicate" do
expect(duplicate_sets).to contain_exactly(
match_array([log.id, duplicate_log.id]),
match_array([duplicate_supported_housing_log.id, supported_housing_log.id]),
contain_exactly(log.id, duplicate_log.id),
contain_exactly(duplicate_supported_housing_log.id, supported_housing_log.id),
)
end
@ -1981,8 +1981,8 @@ RSpec.describe LettingsLog do
supported_housing_log.update!(household_charge: 1, supcharg: nil, brent: nil, scharge: nil, pscharge: nil, tcharge: nil, owning_organisation: organisation)
duplicate_supported_housing_log.update!(household_charge: 1, supcharg: nil, brent: nil, scharge: nil, pscharge: nil, tcharge: nil, owning_organisation: organisation)
expect(duplicate_sets).to contain_exactly(
match_array([log.id, duplicate_log.id]),
match_array([supported_housing_log.id, duplicate_supported_housing_log.id]),
contain_exactly(log.id, duplicate_log.id),
contain_exactly(supported_housing_log.id, duplicate_supported_housing_log.id),
)
end
@ -1998,8 +1998,8 @@ RSpec.describe LettingsLog do
supported_housing_log.update!(is_carehome: 1, chcharge: 100, supcharg: nil, brent: nil, scharge: nil, pscharge: nil, tcharge: nil, owning_organisation: organisation)
duplicate_supported_housing_log.update!(is_carehome: 1, chcharge: 100, supcharg: nil, brent: nil, scharge: nil, pscharge: nil, tcharge: nil, owning_organisation: organisation)
expect(duplicate_sets).to contain_exactly(
match_array([log.id, duplicate_log.id]),
match_array([supported_housing_log.id, duplicate_supported_housing_log.id]),
contain_exactly(log.id, duplicate_log.id),
contain_exactly(supported_housing_log.id, duplicate_supported_housing_log.id),
)
end

2
spec/models/validations/setup_validations_spec.rb

@ -103,7 +103,7 @@ RSpec.describe Validations::SetupValidations do
end
it "adds an error to startdate" do
record.startdate = Time.now + 15.days
record.startdate = Time.zone.now + 15.days
setup_validator.validate_startdate_setup(record)
expect(record.errors["startdate"]).to include(match I18n.t("validations.lettings.setup.startdate.not_within.next_two_weeks"))
end

4
spec/models/validations/soft_validations_spec.rb

@ -505,7 +505,7 @@ RSpec.describe Validations::SoftValidations do
context "when the major repairs date is within 10 years of the tenancy start date" do
it "shows the interruption screen" do
record.startdate = current_collection_start_date
record.mrcdate = current_collection_start_date- 9.years
record.mrcdate = current_collection_start_date - 9.years
expect(record.major_repairs_date_in_soft_range?).to be true
end
end
@ -513,7 +513,7 @@ RSpec.describe Validations::SoftValidations do
context "when the major repairs date is less than 2 years before the tenancy start date" do
it "does not show the interruption screen" do
record.startdate = current_collection_start_date
record.mrcdate = current_collection_start_date- 1.year
record.mrcdate = current_collection_start_date - 1.year
expect(record.major_repairs_date_in_soft_range?).to be false
end
end

37
spec/requests/sales_logs_controller_spec.rb

@ -90,24 +90,25 @@ RSpec.describe SalesLogsController, type: :request do
json_response = JSON.parse(response.body)
expect(response).to have_http_status(:unprocessable_content)
expect(json_response["errors"]).to contain_exactly(
[
"beds",
[
"Number of bedrooms must be 1 if the property is a bedsit."
]
],
[
"proptype",
[
"Answer cannot be 'Bedsit' if the property has 2 or more bedrooms."
]
],
[
"saledate",
[
"Enter a date within the #{previous_collection_start_year} to #{previous_collection_end_year} or #{current_collection_start_year} to #{current_collection_end_year} collection years, which is between 1st April #{previous_collection_start_year} and 31st March #{current_collection_end_year}."
]
])
[
"beds",
[
"Number of bedrooms must be 1 if the property is a bedsit.",
],
],
[
"proptype",
[
"Answer cannot be 'Bedsit' if the property has 2 or more bedrooms.",
],
],
[
"saledate",
[
"Enter a date within the #{previous_collection_start_year} to #{previous_collection_end_year} or #{current_collection_start_year} to #{current_collection_end_year} collection years, which is between 1st April #{previous_collection_start_year} and 31st March #{current_collection_end_year}.",
],
],
)
end
end
end

Loading…
Cancel
Save