makes age errors visible
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user