Skip to content

Commit

Permalink
Adds custom blank errors for admin user forms
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDancingClown committed Aug 3, 2023
1 parent f334638 commit 68c57ab
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ en:

activerecord:
errors:
full_messages:
format: "{{message}}"
messages:
blank: This field cannot be blank
blank: "%{attribute} is empty - it is a required field and must be filled in"
accepted: Must be accepted
taken: "This %{attribute} has already been taken"
too_long: "%{attribute} is too long (maximum is %{count} characters)"
Expand All @@ -71,6 +73,10 @@ en:
models:
user:
attributes:
email:
invalid: "Email is invalid - enter a valid email address"
role:
blank: "Account type is empty - it is a required field and an option should be selected from the following list"
password:
weak_password: Your new password must be more complex.
admin:
Expand All @@ -81,6 +87,10 @@ en:
attributes:
password:
weak_password: Your new password must be more complex.
assessor_assignment:
attributes:
position:
blank: "is empty - it is a required field and an option should be selected from the following list"

time:
formats:
Expand Down
2 changes: 1 addition & 1 deletion spec/features/account/collaborators_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
end

within(".collaborator_email") do
expect_to_see "This field cannot be blank"
expect_to_see "Email is empty - it is a required field and must be filled in"
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/assessor_assignment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
it 'should return error' do
assessor_assignment = build :assessor_assignment, position: nil, form_answer: form
assessor_assignment.valid?
expect(assessor_assignment.as_json).to eq({ :error => ["Position This field cannot be blank"] })
expect(assessor_assignment.as_json).to eq({ :error => ["Position is empty - it is a required field and an option should be selected from the following list"] })
end

it 'should return empty json' do
Expand Down

0 comments on commit 68c57ab

Please sign in to comment.