Browse Source

CLDC-487 - typo fixes

pull/52/head
Matthew Phelan 3 years ago
parent
commit
30b985dfe5
  1. 4
      app/models/case_log.rb
  2. 2
      spec/models/case_log_spec.rb

4
app/models/case_log.rb

@ -17,14 +17,14 @@ class CaseLogValidator < ActiveModel::Validator
def validate_reasonable_preference(record) def validate_reasonable_preference(record)
if record.homelessness == "No" && record.reasonable_preference == "Yes" if record.homelessness == "No" && record.reasonable_preference == "Yes"
record.errors.add :reasonable_preference, "can not be Yes if Not Homesless imediately prior to this letting has been selected" record.errors.add :reasonable_preference, "can not be Yes if Not Homeless immediately prior to this letting has been selected"
elsif record.reasonable_preference == "Yes" elsif record.reasonable_preference == "Yes"
if !record.reasonable_preference_reason_homeless && !record.reasonable_preference_reason_unsatisfactory_housing && !record.reasonable_preference_reason_medical_grounds && !record.reasonable_preference_reason_avoid_hardship && !record.reasonable_preference_reason_do_not_know if !record.reasonable_preference_reason_homeless && !record.reasonable_preference_reason_unsatisfactory_housing && !record.reasonable_preference_reason_medical_grounds && !record.reasonable_preference_reason_avoid_hardship && !record.reasonable_preference_reason_do_not_know
record.errors.add :reasonable_preference_reason, "- if reasonable preference is Yes, a reason must be given" record.errors.add :reasonable_preference_reason, "- if reasonable preference is Yes, a reason must be given"
end end
elsif record.reasonable_preference == "No" elsif record.reasonable_preference == "No"
if record.reasonable_preference_reason_homeless || record.reasonable_preference_reason_unsatisfactory_housing || record.reasonable_preference_reason_medical_grounds || record.reasonable_preference_reason_avoid_hardship || record.reasonable_preference_reason_do_not_know if record.reasonable_preference_reason_homeless || record.reasonable_preference_reason_unsatisfactory_housing || record.reasonable_preference_reason_medical_grounds || record.reasonable_preference_reason_avoid_hardship || record.reasonable_preference_reason_do_not_know
record.errors.add :reasonable_preference_reason, "- if reasonable preference is no, no reasons should be given" record.errors.add :reasonable_preference_reason, "- if reasonable preference is No, no reasons should be given"
end end
end end
end end

2
spec/models/case_log_spec.rb

@ -39,7 +39,7 @@ RSpec.describe Form, type: :model do
}.to raise_error(ActiveRecord::RecordInvalid) }.to raise_error(ActiveRecord::RecordInvalid)
end end
it "if not previously homesless reasonable preference should not be selected" do it "if not previously homeless reasonable preference should not be selected" do
expect { expect {
CaseLog.create!( CaseLog.create!(
homelessness: "No", homelessness: "No",

Loading…
Cancel
Save