mirror of
https://github.com/discourse/discourse.git
synced 2025-09-07 12:02:53 +08:00
FIX: Don't allow invalid email to be saved.
This commit is contained in:
parent
5d7f3223f0
commit
13c6191e89
13 changed files with 97 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue