Commit 98016ef7 authored by Alexis Reigel's avatar Alexis Reigel

add User##verified_email? method

parent 3b090bb9
...@@ -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
......
...@@ -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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment