diff --git a/app/models/officing/residence.rb b/app/models/officing/residence.rb index 5680c9007..fbae39562 100644 --- a/app/models/officing/residence.rb +++ b/app/models/officing/residence.rb @@ -63,7 +63,7 @@ class Officing::Residence return unless @census_api_response.valid? unless allowed_age? - errors.add(:date_of_birth, I18n.t('verification.residence.new.error_not_allowed_age')) + errors.add(:year_of_birth, I18n.t('verification.residence.new.error_not_allowed_age')) end end diff --git a/spec/models/officing/residence_spec.rb b/spec/models/officing/residence_spec.rb index 3653baf7c..a9052fedc 100644 --- a/spec/models/officing/residence_spec.rb +++ b/spec/models/officing/residence_spec.rb @@ -30,13 +30,13 @@ describe Officing::Residence do it "should not be valid if user is under allowed age" do allow_any_instance_of(Officing::Residence).to receive(:date_of_birth).and_return(15.years.ago) expect(residence).to_not be_valid - expect(residence.errors[:date_of_birth]).to include("You don't have the required age to participate") + expect(residence.errors[:year_of_birth]).to include("You don't have the required age to participate") end it "should be valid if user is above allowed age" do allow_any_instance_of(Officing::Residence).to receive(:date_of_birth).and_return(16.years.ago) expect(residence).to be_valid - expect(residence.errors[:date_of_birth]).to be_empty + expect(residence.errors[:year_of_birth]).to be_empty end end @@ -94,4 +94,4 @@ describe Officing::Residence do end end -end \ No newline at end of file +end