Commit 5f0ea83e7a8592ef87a1b796c9041299b6757484

Authored by Antonio Terceiro
1 parent b1c0c2a9

Fix birth date related I18N problems

app/models/person.rb
@@ -122,7 +122,7 @@ class Person < Profile @@ -122,7 +122,7 @@ class Person < Profile
122 122
123 validates_each :birth_date do |record,attr,value| 123 validates_each :birth_date do |record,attr,value|
124 if value && value.year == 1 124 if value && value.year == 1
125 - record.errors.add(attr, _('%{fn} is invalid')) 125 + record.errors.add(attr)
126 end 126 end
127 end 127 end
128 128
@@ -135,7 +135,7 @@ class Person < Profile @@ -135,7 +135,7 @@ class Person < Profile
135 self.required_fields.each do |field| 135 self.required_fields.each do |field|
136 if self.send(field).blank? 136 if self.send(field).blank?
137 unless (field == 'custom_area_of_study' && self.area_of_study != 'Others') || (field == 'custom_formation' && self.formation != 'Others') 137 unless (field == 'custom_area_of_study' && self.area_of_study != 'Others') || (field == 'custom_formation' && self.formation != 'Others')
138 - self.errors.add(field, _('%{fn} is mandatory')) 138 + self.errors.add_on_blank(field)
139 end 139 end
140 end 140 end
141 end 141 end
features/edit_profile.feature
@@ -16,7 +16,7 @@ Feature: edit profile @@ -16,7 +16,7 @@ Feature: edit profile
16 And I select "15" 16 And I select "15"
17 And I press "Save" 17 And I press "Save"
18 Then I should see "Birth date is invalid" 18 Then I should see "Birth date is invalid"
19 - And I should not see "Birth date is mandatory" 19 + And I should not see "Birth date can't be blank"
20 20
21 Scenario: Warn about invalid birth date when required 21 Scenario: Warn about invalid birth date when required
22 Given the following person fields are required fields 22 Given the following person fields are required fields
@@ -28,7 +28,7 @@ Feature: edit profile @@ -28,7 +28,7 @@ Feature: edit profile
28 And I select "15" 28 And I select "15"
29 And I press "Save" 29 And I press "Save"
30 Then I should see "Birth date is invalid" 30 Then I should see "Birth date is invalid"
31 - And I should see "Birth date is mandatory" 31 + And I should not see "Birth date can't be blank"
32 32
33 Scenario: Not warn if birth date is valid when active 33 Scenario: Not warn if birth date is valid when active
34 Given the following person fields are active fields 34 Given the following person fields are active fields