Make email address voluntary in preferences; update tests to handle the added email field better

This commit is contained in:
Jyri-Petteri Paloposki 2020-07-20 20:08:18 +03:00
parent f9f7e6b9ea
commit efee4976b0
5 changed files with 71 additions and 21 deletions

View file

@ -89,6 +89,19 @@ class UserTest < ActiveSupport::TestCase
end
end
def test_validate_correct_email
assert_difference 'User.count' do
create_user :email=> 'testi@example.org'
end
end
def test_validate_email_format
assert_no_difference 'User.count' do
u = create_user :email=> 'test'
assert_equal "is not valid", u.errors[:email]
end
end
def test_display_name_with_first_and_last_name_set
@other_user.first_name = "Jane"
@other_user.last_name = "Doe"