summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-01-19 10:29:06 -0800
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-01-19 10:29:06 -0800
commit3628eb84c4e50ffb73776683aabd19b37c4cd299 (patch)
treeb8136613c6d991432ff9560105d3b117831f6f10 /spec
parent25da1415d385bc5d662998688c0b166b39392f29 (diff)
parent05e4af5b4c7709ab08194d109ddec8e19f44758d (diff)
downloadgitlab-ce-3628eb84c4e50ffb73776683aabd19b37c4cd299.tar.gz
Merge pull request #6072 from jvanbaarsen/fix-3516
Better check on the validity of emails
Diffstat (limited to 'spec')
-rw-r--r--spec/models/user_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index c33b6879cec..5e53ed09b58 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -76,6 +76,27 @@ describe User do
it { should_not allow_value(-1).for(:projects_limit) }
it { should ensure_length_of(:bio).is_within(0..255) }
+
+ describe 'email' do
+ it 'accepts info@example.com' 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 'rejects test@test@example.com' do
+ user = build(:user, email: 'test@test@example.com')
+ expect(user).to be_invalid
+ end
+
+ it 'rejects mailto:test@example.com' do
+ user = build(:user, email: 'mailto:test@example.com')
+ expect(user).to be_invalid
+ end
+ end
end
describe "Respond to" do