summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-06-11 13:22:56 +0200
committerMarin Jankovski <marin@gitlab.com>2014-06-11 13:36:30 +0200
commitf43e41973f912588d7af23a5575ede94a88d3a5d (patch)
treedb4c4aa9bdd71b1e60c9b64b8ac97a9a696ad872
parente57fdc1190af582544154b77f0271ef9f206bc47 (diff)
downloadgitlab-ce-f43e41973f912588d7af23a5575ede94a88d3a5d.tar.gz
Test for the apostrophe in the email
-rw-r--r--lib/email_validator.rb (renamed from lib/gitlab/email_validator.rb)0
-rw-r--r--spec/models/user_spec.rb11
2 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/email_validator.rb b/lib/email_validator.rb
index 0a67ebcd795..0a67ebcd795 100644
--- a/lib/gitlab/email_validator.rb
+++ b/lib/email_validator.rb
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index 34a5bcfb4a5..4e0ebb584d1 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -83,11 +83,17 @@ describe User do
user = build(:user, email: 'info@example.com')
expect(user).to be_valid
end
+
it 'accepts info+test@example.com' do
user = build(:user, email: 'info+test@example.com')
expect(user).to be_valid
end
+ it "accepts o'reilly@example.com" do
+ user = build(:user, email: "o'reilly@example.com")
+ expect(user).to be_valid
+ end
+
it 'rejects test@test@example.com' do
user = build(:user, email: 'test@test@example.com')
expect(user).to be_invalid
@@ -97,6 +103,11 @@ describe User do
user = build(:user, email: 'mailto:test@example.com')
expect(user).to be_invalid
end
+
+ it "rejects lol!'+=?><#$%^&*()@gmail.com" do
+ user = build(:user, email: "lol!'+=?><#$%^&*()@gmail.com")
+ expect(user).to be_invalid
+ end
end
end