Commit 3392f11b authored by zhitomirskiyi's avatar zhitomirskiyi

Job::InviteUser -> Job::InviteUserByEmail

parent 5c5e450a
......@@ -23,7 +23,7 @@ class InvitationsController < Devise::InvitationsController
good_emails, bad_emails = emails.partition{|e| e.try(:match, Devise.email_regexp)}
good_emails.each{|e| Resque.enqueue(Job::InviteUser, current_user.id, e, aspect, message)}
good_emails.each{|e| Resque.enqueue(Job::InviteUserByEmail, current_user.id, e, aspect, message)}
if bad_emails.any?
flash[:error] = I18n.t('invitations.create.sent') + good_emails.join(', ') + " "+ I18n.t('invitations.create.rejected') + bad_emails.join(', ')
......
......@@ -4,7 +4,7 @@
module Job
class InviteUser < Base
class InviteUserByEmail < Base
@queue = :mail
def self.perform_delegate(sender_id, email, aspect_id, invite_message)
user = User.find(sender_id)
......
require 'spec_helper'
describe Job::InviteUserByEmail do
before do
@sender = alice
@email = 'bob@bob.com'
@aspect_id = alice.aspects.first.id
@message = 'invite message'
User.stub(:find){ |id|
if id == @sender.id
@sender
else
nil
end
}
end
it 'calls invite_user with email param' do
@sender.should_receive(:invite_user).with(@aspect_id, 'email', @email, @message)
Job::InviteUserByEmail.perform(@sender.id, @email, @aspect_id, @message)
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