test/models/validatable_test.rb in devise-1.4.2 vs test/models/validatable_test.rb in devise-1.4.3
- old
+ new
@@ -1,5 +1,6 @@
+# encoding: UTF-8
require 'test_helper'
class ValidatableTest < ActiveSupport::TestCase
test 'should require email to be set' do
user = new_user(:email => nil)
@@ -26,21 +27,21 @@
test 'should require correct email format if email has changed, allowing blank' do
user = new_user(:email => '')
assert user.invalid?
assert_not_equal 'is invalid', user.errors[:email].join
- %w(invalid_email_format 123 $$$ \(\) ).each do |email|
+ %w{invalid_email_format 123 $$$ () ☃ bla@bla.}.each do |email|
user.email = email
assert user.invalid?, 'should be invalid with email ' << email
assert_equal 'is invalid', user.errors[:email].join
end
user.save(:validate => false)
assert user.valid?
end
test 'should accept valid emails' do
- %w(a.b.c@example.com test_mail@gmail.com any@any.net email@test.br 123@mail.test).each do |email|
+ %w(a.b.c@example.com test_mail@gmail.com any@any.net email@test.br 123@mail.test 1☃3@mail.test).each do |email|
user = new_user(:email => email)
assert user.valid?, 'should be valid with email ' << email
assert_blank user.errors[:email]
end
end