mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-01 07:11:26 +08:00
Some checks are pending
Licenses / run (push) Waiting to run
Linting / run (push) Waiting to run
Publish Assets / publish-assets (push) Waiting to run
Tests / core backend (push) Waiting to run
Tests / plugins backend (push) Waiting to run
Tests / core frontend (Chrome) (push) Waiting to run
Tests / plugins frontend (push) Waiting to run
Tests / themes frontend (push) Waiting to run
Tests / core system (push) Waiting to run
Tests / plugins system (push) Waiting to run
Tests / themes system (push) Waiting to run
Tests / core frontend (Firefox ESR) (push) Waiting to run
Tests / core frontend (Firefox Evergreen) (push) Waiting to run
Tests / chat system (push) Waiting to run
Tests / merge (push) Blocked by required conditions
* The maximum total length of a user name or other local-part is 64 octets. * The maximum total length of a domain name or number is 255 octets.
25 lines
758 B
Ruby
25 lines
758 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe EmailAddressValidator do
|
|
it "should match valid emails" do
|
|
[
|
|
"test@discourse.org",
|
|
"good_user@discourse.org",
|
|
"incoming+%{reply_key}@discourse.org",
|
|
"a" * 64 + "@" + "b" * 251 + ".com",
|
|
].each { |email| expect(EmailAddressValidator.valid_value?(email)).to eq(true) }
|
|
end
|
|
|
|
it "should not match invalid emails" do
|
|
[
|
|
"testdiscourse.org",
|
|
"frank@invalid_host.contoso.com",
|
|
"frank@invalid_host.com",
|
|
"test@discourse.org; a@discourse.org",
|
|
"random",
|
|
"te=?utf-8?q?st?=@discourse.org",
|
|
"",
|
|
"test" * 100 + "@" + "test" * 100 + ".com",
|
|
].each { |email| expect(EmailAddressValidator.valid_value?(email)).to eq(false) }
|
|
end
|
|
end
|