mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:41:25 +08:00
FIX: Don't allow invalid email to be saved.
This commit is contained in:
@ -32,4 +32,16 @@ describe EmailValidator do
|
||||
end
|
||||
end
|
||||
|
||||
context '.email_regex' do
|
||||
it 'should match valid emails' do
|
||||
expect(!!('test@discourse.org' =~ EmailValidator.email_regex)).to eq(true)
|
||||
end
|
||||
|
||||
it 'should not match invalid emails' do
|
||||
['testdiscourse.org', 'test@discourse.org; a@discourse.org', 'random'].each do |email|
|
||||
expect(!!(email =~ EmailValidator.email_regex)).to eq(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user