Fix failing spec due to missing variable in extracted method

This commit is contained in:
Rafael George 2013-10-04 12:18:07 -04:00
parent 26c090439d
commit 622ffddbb8

View file

@ -426,7 +426,7 @@ class Topic < ActiveRecord::Base
invite = Invite.create(invited_by: invited_by, email: lower_email)
unless invite.valid?
grant_permission_to_user if email_already_exists_for?(invite)
grant_permission_to_user(lower_email) if email_already_exists_for?(invite)
return
end
@ -444,8 +444,8 @@ class Topic < ActiveRecord::Base
invite.email_already_exists and private_message?
end
def grant_permission_to_user
User.where(email: lower_email).first
def grant_permission_to_user(lower_email)
user = User.where(email: lower_email).first
topic_allowed_users.create!(user_id: user.id)
end