Users with no email_tokens return true from email_confirmed

This commit is contained in:
Neil Lalonde 2013-02-12 10:12:32 -05:00
parent 4668cf1d54
commit 238032051e
2 changed files with 2 additions and 2 deletions

View File

@ -381,7 +381,7 @@ class User < ActiveRecord::Base
end
def email_confirmed?
email_tokens.where(email: self.email, confirmed: true).present?
email_tokens.where(email: self.email, confirmed: true).present? or email_tokens.count == 0
end

View File

@ -638,7 +638,7 @@ describe User do
it 'should return false' do
user.email_tokens.each {|t| t.destroy}
user.reload
user.email_confirmed?.should be_false
user.email_confirmed?.should be_true
end
end
end