Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
98016ef7
Commit
98016ef7
authored
Aug 28, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add User##verified_email? method
parent
3b090bb9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
app/models/user.rb
app/models/user.rb
+4
-0
spec/models/user_spec.rb
spec/models/user_spec.rb
+14
-0
No files found.
app/models/user.rb
View file @
98016ef7
...
@@ -1041,6 +1041,10 @@ class User < ActiveRecord::Base
...
@@ -1041,6 +1041,10 @@ class User < ActiveRecord::Base
ensure_rss_token!
ensure_rss_token!
end
end
def
verified_email?
(
email
)
self
.
email
==
email
end
protected
protected
# override, from Devise::Validatable
# override, from Devise::Validatable
...
...
spec/models/user_spec.rb
View file @
98016ef7
...
@@ -2102,4 +2102,18 @@ describe User do
...
@@ -2102,4 +2102,18 @@ describe User do
end
end
end
end
end
end
describe
'#verified_email?'
do
it
'returns true when the email is the primary email'
do
user
=
build
:user
,
email:
'email@example.com'
expect
(
user
.
verified_email?
(
'email@example.com'
)).
to
be
true
end
it
'returns false when the email is not the primary email'
do
user
=
build
:user
,
email:
'email@example.com'
expect
(
user
.
verified_email?
(
'other_email@example.com'
)).
to
be
false
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment