From f859904c767aaf0fc7146824e2fc627227694844 Mon Sep 17 00:00:00 2001 From: Dan Hansen Date: Sun, 9 Oct 2011 22:33:17 -0500 Subject: [PATCH] change namespace from Mail to Mailers locally when Resque tried to constantize Jobs::Mail Object.const_get("Jobs") returned our Jobs module but when it tried to const_get("Mail") it returned the Mail gem. added copyright --- app/mailers/notification_mailers/also_commented.rb | 4 ++++ app/mailers/notification_mailers/base.rb | 4 ++++ .../notification_mailers/comment_on_post.rb | 4 ++++ app/mailers/notification_mailers/confirm_email.rb | 4 ++++ app/mailers/notification_mailers/liked.rb | 4 ++++ app/mailers/notification_mailers/mentioned.rb | 4 ++++ .../notification_mailers/private_message.rb | 4 ++++ app/mailers/notification_mailers/reshared.rb | 4 ++++ .../notification_mailers/started_sharing.rb | 4 ++++ app/mailers/notifier.rb | 4 ++++ app/models/invitation.rb | 2 +- app/models/jobs/base.rb | 2 +- app/models/jobs/mail/confirm_email.rb | 10 ---------- .../jobs/{mail => mailers}/also_commented.rb | 6 +++++- .../jobs/{mail => mailers}/comment_on_post.rb | 7 ++++++- app/models/jobs/mailers/confirm_email.rb | 14 ++++++++++++++ .../jobs/{mail => mailers}/invite_user_by_email.rb | 3 +-- app/models/jobs/{mail => mailers}/liked.rb | 6 +++++- app/models/jobs/{mail => mailers}/mentioned.rb | 3 +-- .../jobs/{mail => mailers}/private_message.rb | 5 ++--- app/models/jobs/{mail => mailers}/reshared.rb | 6 +++++- .../jobs/{mail => mailers}/started_sharing.rb | 3 +-- app/models/jobs/resend_invitation.rb | 1 - app/models/notifications/also_commented.rb | 6 +++++- app/models/notifications/comment_on_post.rb | 6 +++++- app/models/notifications/liked.rb | 6 +++++- app/models/notifications/mentioned.rb | 6 +++++- app/models/notifications/private_message.rb | 6 +++++- app/models/notifications/request_accepted.rb | 6 +++++- app/models/notifications/reshared.rb | 7 +++++-- app/models/notifications/started_sharing.rb | 6 +++++- app/models/user.rb | 6 +++--- spec/controllers/users_controller_spec.rb | 2 +- spec/models/jobs/mail/invite_user_by_email_spec.rb | 8 ++++++-- spec/models/jobs/mail/mail_mentioned_spec.rb | 4 ++-- spec/models/jobs/mail/mail_private_message.rb | 4 ++-- spec/models/jobs/mail/mail_reshared_spec.rb | 4 ++-- spec/models/user_spec.rb | 12 ++++++------ 38 files changed, 144 insertions(+), 53 deletions(-) delete mode 100644 app/models/jobs/mail/confirm_email.rb rename app/models/jobs/{mail => mailers}/also_commented.rb (60%) rename app/models/jobs/{mail => mailers}/comment_on_post.rb (56%) create mode 100644 app/models/jobs/mailers/confirm_email.rb rename app/models/jobs/{mail => mailers}/invite_user_by_email.rb (95%) rename app/models/jobs/{mail => mailers}/liked.rb (53%) rename app/models/jobs/{mail => mailers}/mentioned.rb (95%) rename app/models/jobs/{mail => mailers}/private_message.rb (89%) rename app/models/jobs/{mail => mailers}/reshared.rb (55%) rename app/models/jobs/{mail => mailers}/started_sharing.rb (95%) diff --git a/app/mailers/notification_mailers/also_commented.rb b/app/mailers/notification_mailers/also_commented.rb index a92f3a2af..cf5f2435e 100644 --- a/app/mailers/notification_mailers/also_commented.rb +++ b/app/mailers/notification_mailers/also_commented.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers class AlsoCommented < NotificationMailers::Base include ActionView::Helpers::TextHelper diff --git a/app/mailers/notification_mailers/base.rb b/app/mailers/notification_mailers/base.rb index cc17db364..8fdf23a69 100644 --- a/app/mailers/notification_mailers/base.rb +++ b/app/mailers/notification_mailers/base.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers TRUNCATION_LEN = 70 diff --git a/app/mailers/notification_mailers/comment_on_post.rb b/app/mailers/notification_mailers/comment_on_post.rb index ffb29fbb5..e5fc9e498 100644 --- a/app/mailers/notification_mailers/comment_on_post.rb +++ b/app/mailers/notification_mailers/comment_on_post.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers class CommentOnPost < NotificationMailers::Base include ActionView::Helpers::TextHelper diff --git a/app/mailers/notification_mailers/confirm_email.rb b/app/mailers/notification_mailers/confirm_email.rb index cd94cc76f..11ced8385 100644 --- a/app/mailers/notification_mailers/confirm_email.rb +++ b/app/mailers/notification_mailers/confirm_email.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers class ConfirmEmail < NotificationMailers::Base def set_headers diff --git a/app/mailers/notification_mailers/liked.rb b/app/mailers/notification_mailers/liked.rb index 243e018e4..3c0b07d53 100644 --- a/app/mailers/notification_mailers/liked.rb +++ b/app/mailers/notification_mailers/liked.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers class Liked < NotificationMailers::Base attr_accessor :like diff --git a/app/mailers/notification_mailers/mentioned.rb b/app/mailers/notification_mailers/mentioned.rb index 2d0b5cd60..9e51f4036 100644 --- a/app/mailers/notification_mailers/mentioned.rb +++ b/app/mailers/notification_mailers/mentioned.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers class Mentioned < NotificationMailers::Base attr_accessor :post diff --git a/app/mailers/notification_mailers/private_message.rb b/app/mailers/notification_mailers/private_message.rb index 2cbc655c3..0eff30835 100644 --- a/app/mailers/notification_mailers/private_message.rb +++ b/app/mailers/notification_mailers/private_message.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers class PrivateMessage < NotificationMailers::Base attr_accessor :message, :conversation, :participants diff --git a/app/mailers/notification_mailers/reshared.rb b/app/mailers/notification_mailers/reshared.rb index c8287dd27..9f926137f 100644 --- a/app/mailers/notification_mailers/reshared.rb +++ b/app/mailers/notification_mailers/reshared.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers class Reshared < NotificationMailers::Base attr_accessor :reshare diff --git a/app/mailers/notification_mailers/started_sharing.rb b/app/mailers/notification_mailers/started_sharing.rb index e02c50e43..7edb6b959 100644 --- a/app/mailers/notification_mailers/started_sharing.rb +++ b/app/mailers/notification_mailers/started_sharing.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module NotificationMailers class StartedSharing < NotificationMailers::Base def set_headers diff --git a/app/mailers/notifier.rb b/app/mailers/notifier.rb index bee70b83f..985b2a225 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -1,3 +1,7 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifier < ActionMailer::Base helper :application helper :markdownify diff --git a/app/models/invitation.rb b/app/models/invitation.rb index 3465211df..88f10d25c 100644 --- a/app/models/invitation.rb +++ b/app/models/invitation.rb @@ -135,7 +135,7 @@ class Invitation < ActiveRecord::Base def queue_send! unless self.recipient.present? - Resque.enqueue(Jobs::Mail::InviteUserByEmail, self.id) + Resque.enqueue(Jobs::Mailers::InviteUserByEmail, self.id) end end diff --git a/app/models/jobs/base.rb b/app/models/jobs/base.rb index e09a37d18..d9f2b04bc 100644 --- a/app/models/jobs/base.rb +++ b/app/models/jobs/base.rb @@ -4,7 +4,7 @@ module Jobs class Base - Dir["#{Rails.root}/app/models/jobs/mail/*.rb"].each {|file| require file } + Dir["#{Rails.root}/app/models/jobs/mailers/*.rb"].each {|file| require file } extend ResqueJobLogging end end diff --git a/app/models/jobs/mail/confirm_email.rb b/app/models/jobs/mail/confirm_email.rb deleted file mode 100644 index 6eeb1b1e1..000000000 --- a/app/models/jobs/mail/confirm_email.rb +++ /dev/null @@ -1,10 +0,0 @@ -module Jobs - module Mail - class ConfirmEmail < Base - @queue = :mail - def self.perform(user_id) - Notifier.confirm_email(user_id).deliver - end - end - end -end diff --git a/app/models/jobs/mail/also_commented.rb b/app/models/jobs/mailers/also_commented.rb similarity index 60% rename from app/models/jobs/mail/also_commented.rb rename to app/models/jobs/mailers/also_commented.rb index 6e53ff6cd..7bc794c93 100644 --- a/app/models/jobs/mail/also_commented.rb +++ b/app/models/jobs/mailers/also_commented.rb @@ -1,5 +1,9 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module Jobs - module Mail + module Mailers class AlsoCommented < Base @queue = :mail def self.perform(recipient_id, sender_id, comment_id) diff --git a/app/models/jobs/mail/comment_on_post.rb b/app/models/jobs/mailers/comment_on_post.rb similarity index 56% rename from app/models/jobs/mail/comment_on_post.rb rename to app/models/jobs/mailers/comment_on_post.rb index ddc613571..db7a64431 100644 --- a/app/models/jobs/mail/comment_on_post.rb +++ b/app/models/jobs/mailers/comment_on_post.rb @@ -1,5 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + + module Jobs - module Mail + module Mailers class CommentOnPost < Base @queue = :mail def self.perform(recipient_id, sender_id, comment_id) diff --git a/app/models/jobs/mailers/confirm_email.rb b/app/models/jobs/mailers/confirm_email.rb new file mode 100644 index 000000000..a3b5af723 --- /dev/null +++ b/app/models/jobs/mailers/confirm_email.rb @@ -0,0 +1,14 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + +module Jobs + module Mailers + class ConfirmEmail < Base + @queue = :mail + def self.perform(user_id) + Notifier.confirm_email(user_id).deliver + end + end + end +end diff --git a/app/models/jobs/mail/invite_user_by_email.rb b/app/models/jobs/mailers/invite_user_by_email.rb similarity index 95% rename from app/models/jobs/mail/invite_user_by_email.rb rename to app/models/jobs/mailers/invite_user_by_email.rb index 37b403d34..76663ed8f 100644 --- a/app/models/jobs/mail/invite_user_by_email.rb +++ b/app/models/jobs/mailers/invite_user_by_email.rb @@ -2,9 +2,8 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. - module Jobs - module Mail + module Mailers class InviteUserByEmail < Base @queue = :mail def self.perform(invite_id) diff --git a/app/models/jobs/mail/liked.rb b/app/models/jobs/mailers/liked.rb similarity index 53% rename from app/models/jobs/mail/liked.rb rename to app/models/jobs/mailers/liked.rb index 24b434aa6..ae3050c01 100644 --- a/app/models/jobs/mail/liked.rb +++ b/app/models/jobs/mailers/liked.rb @@ -1,5 +1,9 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module Jobs - module Mail + module Mailers class Liked < Base @queue = :mail def self.perform(recipient_id, sender_id, like_id) diff --git a/app/models/jobs/mail/mentioned.rb b/app/models/jobs/mailers/mentioned.rb similarity index 95% rename from app/models/jobs/mail/mentioned.rb rename to app/models/jobs/mailers/mentioned.rb index 4a91f01dc..7fa27e98c 100644 --- a/app/models/jobs/mail/mentioned.rb +++ b/app/models/jobs/mailers/mentioned.rb @@ -2,9 +2,8 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. - module Jobs - module Mail + module Mailers class Mentioned < Base @queue = :mail def self.perform(recipient_id, actor_id, target_id) diff --git a/app/models/jobs/mail/private_message.rb b/app/models/jobs/mailers/private_message.rb similarity index 89% rename from app/models/jobs/mail/private_message.rb rename to app/models/jobs/mailers/private_message.rb index ae4d71a1d..e8d199783 100644 --- a/app/models/jobs/mail/private_message.rb +++ b/app/models/jobs/mailers/private_message.rb @@ -2,11 +2,10 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. - module Jobs - module Mail + module Mailers class PrivateMessage < Base - @queue = :mail + @queue = :mailers def self.perform(recipient_id, actor_id, target_id) Notifier.private_message( recipient_id, actor_id, target_id).deliver end diff --git a/app/models/jobs/mail/reshared.rb b/app/models/jobs/mailers/reshared.rb similarity index 55% rename from app/models/jobs/mail/reshared.rb rename to app/models/jobs/mailers/reshared.rb index 8c768236e..80cded38f 100644 --- a/app/models/jobs/mail/reshared.rb +++ b/app/models/jobs/mailers/reshared.rb @@ -1,5 +1,9 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + module Jobs - module Mail + module Mailers class Reshared < Base @queue = :mail def self.perform(recipient_id, sender_id, reshare_id) diff --git a/app/models/jobs/mail/started_sharing.rb b/app/models/jobs/mailers/started_sharing.rb similarity index 95% rename from app/models/jobs/mail/started_sharing.rb rename to app/models/jobs/mailers/started_sharing.rb index 4fa482146..7c453ed01 100644 --- a/app/models/jobs/mail/started_sharing.rb +++ b/app/models/jobs/mailers/started_sharing.rb @@ -2,9 +2,8 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. - module Jobs - module Mail + module Mailers class StartedSharing < Base @queue = :mail def self.perform(recipient_id, sender_id, target_id) diff --git a/app/models/jobs/resend_invitation.rb b/app/models/jobs/resend_invitation.rb index 0b06ea63e..569be4eb0 100644 --- a/app/models/jobs/resend_invitation.rb +++ b/app/models/jobs/resend_invitation.rb @@ -2,7 +2,6 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. - module Jobs class ResendInvitation < Base @queue = :mail diff --git a/app/models/notifications/also_commented.rb b/app/models/notifications/also_commented.rb index 0268281cf..abb76ff60 100644 --- a/app/models/notifications/also_commented.rb +++ b/app/models/notifications/also_commented.rb @@ -1,6 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifications::AlsoCommented < Notification def mail_job - Jobs::Mail::AlsoCommented + Jobs::Mailers::AlsoCommented end def popup_translation_key diff --git a/app/models/notifications/comment_on_post.rb b/app/models/notifications/comment_on_post.rb index f8b6fe45e..92670aeb4 100644 --- a/app/models/notifications/comment_on_post.rb +++ b/app/models/notifications/comment_on_post.rb @@ -1,6 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifications::CommentOnPost < Notification def mail_job - Jobs::Mail::CommentOnPost + Jobs::Mailers::CommentOnPost end def popup_translation_key diff --git a/app/models/notifications/liked.rb b/app/models/notifications/liked.rb index abf62f58f..ea729f7b5 100644 --- a/app/models/notifications/liked.rb +++ b/app/models/notifications/liked.rb @@ -1,6 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifications::Liked < Notification def mail_job - Jobs::Mail::Liked + Jobs::Mailers::Liked end def popup_translation_key diff --git a/app/models/notifications/mentioned.rb b/app/models/notifications/mentioned.rb index 165395512..568674e26 100644 --- a/app/models/notifications/mentioned.rb +++ b/app/models/notifications/mentioned.rb @@ -1,6 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifications::Mentioned < Notification def mail_job - Jobs::Mail::Mentioned + Jobs::Mailers::Mentioned end def popup_translation_key diff --git a/app/models/notifications/private_message.rb b/app/models/notifications/private_message.rb index 6a064ffb9..49cb57f2d 100644 --- a/app/models/notifications/private_message.rb +++ b/app/models/notifications/private_message.rb @@ -1,6 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifications::PrivateMessage < Notification def mail_job - Jobs::Mail::PrivateMessage + Jobs::Mailers::PrivateMessage end def popup_translation_key 'notifications.private_message' diff --git a/app/models/notifications/request_accepted.rb b/app/models/notifications/request_accepted.rb index 4f85e66e0..df02fc93a 100644 --- a/app/models/notifications/request_accepted.rb +++ b/app/models/notifications/request_accepted.rb @@ -1,6 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifications::RequestAccepted < Notification def mail_job - Jobs::Mail::RequestAcceptance + Jobs::Mailers::RequestAcceptance end def popup_translation_key 'notifications.request_accepted' diff --git a/app/models/notifications/reshared.rb b/app/models/notifications/reshared.rb index 3032a6ac7..badec0809 100644 --- a/app/models/notifications/reshared.rb +++ b/app/models/notifications/reshared.rb @@ -1,7 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifications::Reshared < Notification def mail_job - Jobs::Mail::Reshared - #Jobs::Mail::Liked + Jobs::Mailers::Reshared end def popup_translation_key diff --git a/app/models/notifications/started_sharing.rb b/app/models/notifications/started_sharing.rb index 0d366fe96..ce150d351 100644 --- a/app/models/notifications/started_sharing.rb +++ b/app/models/notifications/started_sharing.rb @@ -1,6 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + class Notifications::StartedSharing < Notification def mail_job - Jobs::Mail::StartedSharing + Jobs::Mailers::StartedSharing end def popup_translation_key diff --git a/app/models/user.rb b/app/models/user.rb index 60349daaf..4928c66c7 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -267,15 +267,15 @@ class User < ActiveRecord::Base ######### Mailer ####################### def mail(job, *args) - pref = job.to_s.gsub('Jobs::Mail::', '').underscore + pref = job.to_s.gsub('Jobs::Mailers::', '').underscore if(self.disable_mail == false && !self.user_preferences.exists?(:email_type => pref)) Resque.enqueue(job, *args) end end - def mail_confirm_email + def mail_confirm_email return false if unconfirmed_email.blank? - Resque.enqueue(Jobs::Mail::ConfirmEmail, id) + Resque.enqueue(Jobs::Mailers::ConfirmEmail, id) true end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index 4f3b48483..ed25df363 100644 --- a/spec/controllers/users_controller_spec.rb +++ b/spec/controllers/users_controller_spec.rb @@ -136,7 +136,7 @@ describe UsersController do end it 'sends out activation email on success' do - Resque.should_receive(:enqueue).with(Jobs::Mail::ConfirmEmail, @user.id).once + Resque.should_receive(:enqueue).with(Jobs::Mailers::ConfirmEmail, @user.id).once put(:update, :id => @user.id, :user => { :email => "my@newemail.com"}) end end diff --git a/spec/models/jobs/mail/invite_user_by_email_spec.rb b/spec/models/jobs/mail/invite_user_by_email_spec.rb index 2e4cdfcfe..59d934e55 100644 --- a/spec/models/jobs/mail/invite_user_by_email_spec.rb +++ b/spec/models/jobs/mail/invite_user_by_email_spec.rb @@ -1,6 +1,10 @@ +# Copyright (c) 2010-2011, Diaspora Inc. This file is +# licensed under the Affero General Public License version 3 or later. See +# the COPYRIGHT file. + require 'spec_helper' -describe Jobs::Mail::InviteUserByEmail do +describe Jobs::Mailers::InviteUserByEmail do before do @sender = alice @email = 'bob@bob.com' @@ -12,6 +16,6 @@ describe Jobs::Mail::InviteUserByEmail do invitation = Invitation.create(:sender => @sender, :identifier => @email, :service => "email", :aspect => @aspect, :message => @message) invitation.should_receive(:send!) Invitation.stub(:find).and_return(invitation) - Jobs::Mail::InviteUserByEmail.perform(invitation.id) + Jobs::Mailers::InviteUserByEmail.perform(invitation.id) end end diff --git a/spec/models/jobs/mail/mail_mentioned_spec.rb b/spec/models/jobs/mail/mail_mentioned_spec.rb index e380dba33..f4b4ec0a2 100644 --- a/spec/models/jobs/mail/mail_mentioned_spec.rb +++ b/spec/models/jobs/mail/mail_mentioned_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' -describe Jobs::Mail::Mentioned do +describe Jobs::Mailers::Mentioned do describe '#perfom' do it 'should call .deliver on the notifier object' do user = alice @@ -15,7 +15,7 @@ describe Jobs::Mail::Mentioned do mail_mock.should_receive(:deliver) Notifier.should_receive(:mentioned).with(user.id, sm.author.id, m.id).and_return(mail_mock) - Jobs::Mail::Mentioned.perform(user.id, sm.author.id, m.id) + Jobs::Mailers::Mentioned.perform(user.id, sm.author.id, m.id) end end end diff --git a/spec/models/jobs/mail/mail_private_message.rb b/spec/models/jobs/mail/mail_private_message.rb index 5de3328e9..05bcf3c6f 100644 --- a/spec/models/jobs/mail/mail_private_message.rb +++ b/spec/models/jobs/mail/mail_private_message.rb @@ -4,7 +4,7 @@ require 'spec_helper' -describe Jobs::Mail::PrivateMessage do +describe Jobs::Mailers::PrivateMessage do describe '#perfom_delegate' do it 'should call .deliver on the notifier object' do user1 = alice @@ -21,7 +21,7 @@ describe Jobs::Mail::PrivateMessage do mail_mock.should_receive(:deliver) Notifier.should_receive(:mentioned).with(user2.id, user1.person.id, message.id).and_return(mail_mock) - Jobs::Mail::Mentioned.perform(user2.id, user1.person.id, message.id) + Jobs::Mailers::Mentioned.perform(user2.id, user1.person.id, message.id) end end end diff --git a/spec/models/jobs/mail/mail_reshared_spec.rb b/spec/models/jobs/mail/mail_reshared_spec.rb index 39d0693ee..e8c21b195 100644 --- a/spec/models/jobs/mail/mail_reshared_spec.rb +++ b/spec/models/jobs/mail/mail_reshared_spec.rb @@ -4,7 +4,7 @@ require 'spec_helper' -describe Jobs::Mail::Reshared do +describe Jobs::Mailers::Reshared do describe '#perfom' do it 'should call .deliver on the notifier object' do sm = Factory(:status_message, :author => bob.person, :public => true) @@ -14,7 +14,7 @@ describe Jobs::Mail::Reshared do mail_mock.should_receive(:deliver) Notifier.should_receive(:reshared).with(bob.id, reshare.author.id, reshare.id).and_return(mail_mock) - Jobs::Mail::Reshared.perform(bob.id, reshare.author.id, reshare.id) + Jobs::Mailers::Reshared.perform(bob.id, reshare.author.id, reshare.id) end end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 2138a7e73..fb2596c91 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -661,14 +661,14 @@ describe User do alice.disable_mail = false alice.save - Resque.should_receive(:enqueue).with(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid').once - alice.mail(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid') + Resque.should_receive(:enqueue).with(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid').once + alice.mail(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid') end it 'does not enqueue a mail job if the correct corresponding job has a prefrence entry' do alice.user_preferences.create(:email_type => 'started_sharing') Resque.should_not_receive(:enqueue) - alice.mail(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid') + alice.mail(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid') end it 'does not send a mail if disable_mail is set to true' do @@ -676,7 +676,7 @@ describe User do alice.save alice.reload Resque.should_not_receive(:enqueue) - alice.mail(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid') + alice.mail(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid') end end @@ -823,12 +823,12 @@ describe User do describe '#mail_confirm_email' do it 'enqueues a mail job on user with unconfirmed email' do user.update_attribute(:unconfirmed_email, "alice@newmail.com") - Resque.should_receive(:enqueue).with(Jobs::Mail::ConfirmEmail, alice.id).once + Resque.should_receive(:enqueue).with(Jobs::Mailers::ConfirmEmail, alice.id).once alice.mail_confirm_email.should eql(true) end it 'enqueues NO mail job on user without unconfirmed email' do - Resque.should_not_receive(:enqueue).with(Jobs::Mail::ConfirmEmail, alice.id) + Resque.should_not_receive(:enqueue).with(Jobs::Mailers::ConfirmEmail, alice.id) alice.mail_confirm_email.should eql(false) end end