-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- changed method to add error to the record by adding "error_code"
- Loading branch information
Showing
3 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,21 @@ def test_validation | |
user = User.new(email: "Pat.Jones+ASDF#GMAIL.com") | ||
assert_equal false, user.valid? | ||
assert user.errors.messages[:email].first | ||
|
||
user = User.new(email: "[email protected]") | ||
assert_equal true, user.valid? | ||
end | ||
end | ||
|
||
def test_validation_error_message | ||
if RUBY_PLATFORM != "java" # jruby | ||
user = User.new(alternate_email: "Pat.Jones+ASDF#GMAIL.com") | ||
assert_equal false, user.valid? | ||
assert user.errors.messages[:alternate_email].first.include?("Check your email") | ||
assert_equal :some_error_code, user.errors.details[:alternate_email].first[:error] | ||
end | ||
end | ||
|
||
def test_datatype | ||
# Disabled JRuby checks... weird CI failures. Hopefully someone can help? | ||
if RUBY_PLATFORM != "java" # jruby | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters