diff --git a/app/models/user.rb b/app/models/user.rb index 3a9aebfb2..f3e4f6b47 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -63,6 +63,7 @@ class User < ApplicationRecord # Callback provided by Devise def after_confirmation + update!(email_verified_at: Time.zone.now) link_invites! end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 336d78886..958346a47 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -16,6 +16,12 @@ describe User, type: :model do user.confirm expect(user.reload.invites.size).to eq(2) end + + it 'verifies its email' do + expect(user.email_verified_at).to be_nil + user.confirm + expect(user.email_verified_at).to be_present + end end describe '#owns?' do