-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated email_regexp and added test cases (#4001)
Add a more permissive default e-mail regex.
- Loading branch information
1 parent
209b97d
commit 830d3e8
Showing
4 changed files
with
10 additions
and
24 deletions.
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
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 |
---|---|---|
|
@@ -37,8 +37,7 @@ class DeviseTest < ActiveSupport::TestCase | |
|
||
test 'setup block warns about defaults changing' do | ||
Devise.app_set_configs = Set.new | ||
|
||
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /email_regexp/ } | ||
|
||
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /reconfirmable/ } | ||
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /sign_out_via/ } | ||
ActiveSupport::Deprecation.expects(:warn).with() { |value| value =~ /skip_session_storage/ } | ||
|
@@ -52,7 +51,6 @@ class DeviseTest < ActiveSupport::TestCase | |
ActiveSupport::Deprecation.expects(:warn).never | ||
|
||
swap Devise, | ||
email_regexp: /@/, | ||
reconfirmable: false, | ||
sign_out_via: :get, | ||
skip_session_storage: [], | ||
|
@@ -121,8 +119,8 @@ class DeviseTest < ActiveSupport::TestCase | |
end | ||
|
||
test 'Devise.email_regexp should match valid email addresses' do | ||
valid_emails = ["[email protected]", "[email protected]", "[email protected]", "[email protected]"] | ||
non_valid_emails = ["rex", "test@go,com", "test [email protected]", "test_user@example server.com", "[email protected]."] | ||
valid_emails = ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "test@tt", "[email protected]"] | ||
non_valid_emails = ["rex", "test [email protected]", "test_user@example server.com"] | ||
|
||
valid_emails.each do |email| | ||
assert_match Devise.email_regexp, email | ||
|
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