Browse Source

correct linting errors, minor test failure and typo

pull/1101/head
Arthur Campbell 3 years ago
parent
commit
53da6aced9
  1. 6
      app/models/validations/sales/financial_validations.rb
  2. 12
      spec/helpers/interruption_screen_helper_spec.rb
  3. 4
      spec/models/form_handler_spec.rb

6
app/models/validations/sales/financial_validations.rb

@ -3,7 +3,7 @@ module Validations::Sales::FinancialValidations
# or 'validate_' to run on submit as well # or 'validate_' to run on submit as well
def validate_income1(record) def validate_income1(record)
return unless record.income1 && record.la && record.shared_owhership_scheme? return unless record.income1 && record.la && record.shared_ownership_scheme?
relevant_fields = %i[income1 ownershipsch la postcode_full] relevant_fields = %i[income1 ownershipsch la postcode_full]
if record.london_property? && record.income1 > 90_000 if record.london_property? && record.income1 > 90_000
@ -14,7 +14,7 @@ module Validations::Sales::FinancialValidations
end end
def validate_income2(record) def validate_income2(record)
return unless record.income2 && record.la && record.shared_owhership_scheme? return unless record.income2 && record.la && record.shared_ownership_scheme?
relevant_fields = %i[income2 ownershipsch la postcode_full] relevant_fields = %i[income2 ownershipsch la postcode_full]
if record.london_property? && record.income2 > 90_000 if record.london_property? && record.income2 > 90_000
@ -25,7 +25,7 @@ module Validations::Sales::FinancialValidations
end end
def validate_combined_income(record) def validate_combined_income(record)
return unless record.income1 && record.income2 && record.la && record.shared_owhership_scheme? return unless record.income1 && record.income2 && record.la && record.shared_ownership_scheme?
combined_income = record.income1 + record.income2 combined_income = record.income1 + record.income2
relevant_fields = %i[income1 income2 ownershipsch la postcode_full] relevant_fields = %i[income1 income2 ownershipsch la postcode_full]

12
spec/helpers/interruption_screen_helper_spec.rb

@ -105,8 +105,8 @@ RSpec.describe InterruptionScreenHelper do
{ {
"key" => "earnings", "key" => "earnings",
"i18n_template" => "argument", "i18n_template" => "argument",
} },
] ],
} }
expect(display_informative_text(informative_text_hash, lettings_log)).to eq(I18n.t(translation, argument: lettings_log.earnings)) expect(display_informative_text(informative_text_hash, lettings_log)).to eq(I18n.t(translation, argument: lettings_log.earnings))
end end
@ -120,8 +120,8 @@ RSpec.describe InterruptionScreenHelper do
"key" => "retirement_age_for_person", "key" => "retirement_age_for_person",
"arguments_for_key" => 1, "arguments_for_key" => 1,
"i18n_template" => "argument", "i18n_template" => "argument",
} },
] ],
} }
allow(lettings_log).to receive(:retirement_age_for_person) allow(lettings_log).to receive(:retirement_age_for_person)
display_informative_text(informative_text_hash, lettings_log) display_informative_text(informative_text_hash, lettings_log)
@ -137,8 +137,8 @@ RSpec.describe InterruptionScreenHelper do
"key" => "retirement_age_for_person", "key" => "retirement_age_for_person",
"arguments_for_key" => 1, "arguments_for_key" => 1,
"i18n_template" => "argument", "i18n_template" => "argument",
} },
] ],
} }
expect(display_informative_text(informative_text_hash, lettings_log)).to eq(I18n.t(translation, argument: lettings_log.retirement_age_for_person(1))) expect(display_informative_text(informative_text_hash, lettings_log)).to eq(I18n.t(translation, argument: lettings_log.retirement_age_for_person(1)))
end end

4
spec/models/form_handler_spec.rb

@ -52,14 +52,14 @@ RSpec.describe FormHandler do
it "is able to load a current sales form" do it "is able to load a current sales form" do
form = form_handler.get_form("current_sales") form = form_handler.get_form("current_sales")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(212) expect(form.pages.count).to eq(181)
expect(form.name).to eq("2022_2023_sales") expect(form.name).to eq("2022_2023_sales")
end end
it "is able to load a previous sales form" do it "is able to load a previous sales form" do
form = form_handler.get_form("previous_sales") form = form_handler.get_form("previous_sales")
expect(form).to be_a(Form) expect(form).to be_a(Form)
expect(form.pages.count).to eq(212) expect(form.pages.count).to eq(181)
expect(form.name).to eq("2021_2022_sales") expect(form.name).to eq("2021_2022_sales")
end end
end end

Loading…
Cancel
Save