From f6845c360f0a357c97e92e05f112d7fc102832ec Mon Sep 17 00:00:00 2001 From: Dan Hansen Date: Sun, 9 Oct 2011 23:34:03 -0500 Subject: [PATCH] Revert "change namespace from Mail to Mailers" This reverts commit f859904c767aaf0fc7146824e2fc627227694844. --- 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 +- .../jobs/{mailers => mail}/also_commented.rb | 6 +----- .../jobs/{mailers => mail}/comment_on_post.rb | 7 +------ app/models/jobs/mail/confirm_email.rb | 10 ++++++++++ .../jobs/{mailers => mail}/invite_user_by_email.rb | 3 ++- app/models/jobs/{mailers => mail}/liked.rb | 6 +----- app/models/jobs/{mailers => mail}/mentioned.rb | 3 ++- .../jobs/{mailers => mail}/private_message.rb | 5 +++-- app/models/jobs/{mailers => mail}/reshared.rb | 6 +----- .../jobs/{mailers => mail}/started_sharing.rb | 3 ++- app/models/jobs/mailers/confirm_email.rb | 14 -------------- 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, 53 insertions(+), 144 deletions(-) rename app/models/jobs/{mailers => mail}/also_commented.rb (60%) rename app/models/jobs/{mailers => mail}/comment_on_post.rb (56%) create mode 100644 app/models/jobs/mail/confirm_email.rb rename app/models/jobs/{mailers => mail}/invite_user_by_email.rb (95%) rename app/models/jobs/{mailers => mail}/liked.rb (53%) rename app/models/jobs/{mailers => mail}/mentioned.rb (95%) rename app/models/jobs/{mailers => mail}/private_message.rb (89%) rename app/models/jobs/{mailers => mail}/reshared.rb (55%) rename app/models/jobs/{mailers => mail}/started_sharing.rb (95%) delete mode 100644 app/models/jobs/mailers/confirm_email.rb diff --git a/app/mailers/notification_mailers/also_commented.rb b/app/mailers/notification_mailers/also_commented.rb index cf5f2435e..a92f3a2af 100644 --- a/app/mailers/notification_mailers/also_commented.rb +++ b/app/mailers/notification_mailers/also_commented.rb @@ -1,7 +1,3 @@ -# 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 8fdf23a69..cc17db364 100644 --- a/app/mailers/notification_mailers/base.rb +++ b/app/mailers/notification_mailers/base.rb @@ -1,7 +1,3 @@ -# 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 e5fc9e498..ffb29fbb5 100644 --- a/app/mailers/notification_mailers/comment_on_post.rb +++ b/app/mailers/notification_mailers/comment_on_post.rb @@ -1,7 +1,3 @@ -# 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 11ced8385..cd94cc76f 100644 --- a/app/mailers/notification_mailers/confirm_email.rb +++ b/app/mailers/notification_mailers/confirm_email.rb @@ -1,7 +1,3 @@ -# 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 3c0b07d53..243e018e4 100644 --- a/app/mailers/notification_mailers/liked.rb +++ b/app/mailers/notification_mailers/liked.rb @@ -1,7 +1,3 @@ -# 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 9e51f4036..2d0b5cd60 100644 --- a/app/mailers/notification_mailers/mentioned.rb +++ b/app/mailers/notification_mailers/mentioned.rb @@ -1,7 +1,3 @@ -# 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 0eff30835..2cbc655c3 100644 --- a/app/mailers/notification_mailers/private_message.rb +++ b/app/mailers/notification_mailers/private_message.rb @@ -1,7 +1,3 @@ -# 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 9f926137f..c8287dd27 100644 --- a/app/mailers/notification_mailers/reshared.rb +++ b/app/mailers/notification_mailers/reshared.rb @@ -1,7 +1,3 @@ -# 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 7edb6b959..e02c50e43 100644 --- a/app/mailers/notification_mailers/started_sharing.rb +++ b/app/mailers/notification_mailers/started_sharing.rb @@ -1,7 +1,3 @@ -# 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 985b2a225..bee70b83f 100644 --- a/app/mailers/notifier.rb +++ b/app/mailers/notifier.rb @@ -1,7 +1,3 @@ -# 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 88f10d25c..3465211df 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::Mailers::InviteUserByEmail, self.id) + Resque.enqueue(Jobs::Mail::InviteUserByEmail, self.id) end end diff --git a/app/models/jobs/base.rb b/app/models/jobs/base.rb index d9f2b04bc..e09a37d18 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/mailers/*.rb"].each {|file| require file } + Dir["#{Rails.root}/app/models/jobs/mail/*.rb"].each {|file| require file } extend ResqueJobLogging end end diff --git a/app/models/jobs/mailers/also_commented.rb b/app/models/jobs/mail/also_commented.rb similarity index 60% rename from app/models/jobs/mailers/also_commented.rb rename to app/models/jobs/mail/also_commented.rb index 7bc794c93..6e53ff6cd 100644 --- a/app/models/jobs/mailers/also_commented.rb +++ b/app/models/jobs/mail/also_commented.rb @@ -1,9 +1,5 @@ -# 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 + module Mail class AlsoCommented < Base @queue = :mail def self.perform(recipient_id, sender_id, comment_id) diff --git a/app/models/jobs/mailers/comment_on_post.rb b/app/models/jobs/mail/comment_on_post.rb similarity index 56% rename from app/models/jobs/mailers/comment_on_post.rb rename to app/models/jobs/mail/comment_on_post.rb index db7a64431..ddc613571 100644 --- a/app/models/jobs/mailers/comment_on_post.rb +++ b/app/models/jobs/mail/comment_on_post.rb @@ -1,10 +1,5 @@ -# 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 + module Mail class CommentOnPost < Base @queue = :mail def self.perform(recipient_id, sender_id, comment_id) diff --git a/app/models/jobs/mail/confirm_email.rb b/app/models/jobs/mail/confirm_email.rb new file mode 100644 index 000000000..6eeb1b1e1 --- /dev/null +++ b/app/models/jobs/mail/confirm_email.rb @@ -0,0 +1,10 @@ +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/mailers/invite_user_by_email.rb b/app/models/jobs/mail/invite_user_by_email.rb similarity index 95% rename from app/models/jobs/mailers/invite_user_by_email.rb rename to app/models/jobs/mail/invite_user_by_email.rb index 76663ed8f..37b403d34 100644 --- a/app/models/jobs/mailers/invite_user_by_email.rb +++ b/app/models/jobs/mail/invite_user_by_email.rb @@ -2,8 +2,9 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. + module Jobs - module Mailers + module Mail class InviteUserByEmail < Base @queue = :mail def self.perform(invite_id) diff --git a/app/models/jobs/mailers/liked.rb b/app/models/jobs/mail/liked.rb similarity index 53% rename from app/models/jobs/mailers/liked.rb rename to app/models/jobs/mail/liked.rb index ae3050c01..24b434aa6 100644 --- a/app/models/jobs/mailers/liked.rb +++ b/app/models/jobs/mail/liked.rb @@ -1,9 +1,5 @@ -# 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 + module Mail class Liked < Base @queue = :mail def self.perform(recipient_id, sender_id, like_id) diff --git a/app/models/jobs/mailers/mentioned.rb b/app/models/jobs/mail/mentioned.rb similarity index 95% rename from app/models/jobs/mailers/mentioned.rb rename to app/models/jobs/mail/mentioned.rb index 7fa27e98c..4a91f01dc 100644 --- a/app/models/jobs/mailers/mentioned.rb +++ b/app/models/jobs/mail/mentioned.rb @@ -2,8 +2,9 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. + module Jobs - module Mailers + module Mail class Mentioned < Base @queue = :mail def self.perform(recipient_id, actor_id, target_id) diff --git a/app/models/jobs/mailers/private_message.rb b/app/models/jobs/mail/private_message.rb similarity index 89% rename from app/models/jobs/mailers/private_message.rb rename to app/models/jobs/mail/private_message.rb index e8d199783..ae4d71a1d 100644 --- a/app/models/jobs/mailers/private_message.rb +++ b/app/models/jobs/mail/private_message.rb @@ -2,10 +2,11 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. + module Jobs - module Mailers + module Mail class PrivateMessage < Base - @queue = :mailers + @queue = :mail 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/mailers/reshared.rb b/app/models/jobs/mail/reshared.rb similarity index 55% rename from app/models/jobs/mailers/reshared.rb rename to app/models/jobs/mail/reshared.rb index 80cded38f..8c768236e 100644 --- a/app/models/jobs/mailers/reshared.rb +++ b/app/models/jobs/mail/reshared.rb @@ -1,9 +1,5 @@ -# 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 + module Mail class Reshared < Base @queue = :mail def self.perform(recipient_id, sender_id, reshare_id) diff --git a/app/models/jobs/mailers/started_sharing.rb b/app/models/jobs/mail/started_sharing.rb similarity index 95% rename from app/models/jobs/mailers/started_sharing.rb rename to app/models/jobs/mail/started_sharing.rb index 7c453ed01..4fa482146 100644 --- a/app/models/jobs/mailers/started_sharing.rb +++ b/app/models/jobs/mail/started_sharing.rb @@ -2,8 +2,9 @@ # licensed under the Affero General Public License version 3 or later. See # the COPYRIGHT file. + module Jobs - module Mailers + module Mail class StartedSharing < Base @queue = :mail def self.perform(recipient_id, sender_id, target_id) diff --git a/app/models/jobs/mailers/confirm_email.rb b/app/models/jobs/mailers/confirm_email.rb deleted file mode 100644 index a3b5af723..000000000 --- a/app/models/jobs/mailers/confirm_email.rb +++ /dev/null @@ -1,14 +0,0 @@ -# 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/resend_invitation.rb b/app/models/jobs/resend_invitation.rb index 569be4eb0..0b06ea63e 100644 --- a/app/models/jobs/resend_invitation.rb +++ b/app/models/jobs/resend_invitation.rb @@ -2,6 +2,7 @@ # 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 abb76ff60..0268281cf 100644 --- a/app/models/notifications/also_commented.rb +++ b/app/models/notifications/also_commented.rb @@ -1,10 +1,6 @@ -# 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::Mailers::AlsoCommented + Jobs::Mail::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 92670aeb4..f8b6fe45e 100644 --- a/app/models/notifications/comment_on_post.rb +++ b/app/models/notifications/comment_on_post.rb @@ -1,10 +1,6 @@ -# 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::Mailers::CommentOnPost + Jobs::Mail::CommentOnPost end def popup_translation_key diff --git a/app/models/notifications/liked.rb b/app/models/notifications/liked.rb index ea729f7b5..abf62f58f 100644 --- a/app/models/notifications/liked.rb +++ b/app/models/notifications/liked.rb @@ -1,10 +1,6 @@ -# 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::Mailers::Liked + Jobs::Mail::Liked end def popup_translation_key diff --git a/app/models/notifications/mentioned.rb b/app/models/notifications/mentioned.rb index 568674e26..165395512 100644 --- a/app/models/notifications/mentioned.rb +++ b/app/models/notifications/mentioned.rb @@ -1,10 +1,6 @@ -# 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::Mailers::Mentioned + Jobs::Mail::Mentioned end def popup_translation_key diff --git a/app/models/notifications/private_message.rb b/app/models/notifications/private_message.rb index 49cb57f2d..6a064ffb9 100644 --- a/app/models/notifications/private_message.rb +++ b/app/models/notifications/private_message.rb @@ -1,10 +1,6 @@ -# 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::Mailers::PrivateMessage + Jobs::Mail::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 df02fc93a..4f85e66e0 100644 --- a/app/models/notifications/request_accepted.rb +++ b/app/models/notifications/request_accepted.rb @@ -1,10 +1,6 @@ -# 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::Mailers::RequestAcceptance + Jobs::Mail::RequestAcceptance end def popup_translation_key 'notifications.request_accepted' diff --git a/app/models/notifications/reshared.rb b/app/models/notifications/reshared.rb index badec0809..3032a6ac7 100644 --- a/app/models/notifications/reshared.rb +++ b/app/models/notifications/reshared.rb @@ -1,10 +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 Notifications::Reshared < Notification def mail_job - Jobs::Mailers::Reshared + Jobs::Mail::Reshared + #Jobs::Mail::Liked end def popup_translation_key diff --git a/app/models/notifications/started_sharing.rb b/app/models/notifications/started_sharing.rb index ce150d351..0d366fe96 100644 --- a/app/models/notifications/started_sharing.rb +++ b/app/models/notifications/started_sharing.rb @@ -1,10 +1,6 @@ -# 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::Mailers::StartedSharing + Jobs::Mail::StartedSharing end def popup_translation_key diff --git a/app/models/user.rb b/app/models/user.rb index 4928c66c7..60349daaf 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::Mailers::', '').underscore + pref = job.to_s.gsub('Jobs::Mail::', '').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::Mailers::ConfirmEmail, id) + Resque.enqueue(Jobs::Mail::ConfirmEmail, id) true end diff --git a/spec/controllers/users_controller_spec.rb b/spec/controllers/users_controller_spec.rb index ed25df363..4f3b48483 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::Mailers::ConfirmEmail, @user.id).once + Resque.should_receive(:enqueue).with(Jobs::Mail::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 59d934e55..2e4cdfcfe 100644 --- a/spec/models/jobs/mail/invite_user_by_email_spec.rb +++ b/spec/models/jobs/mail/invite_user_by_email_spec.rb @@ -1,10 +1,6 @@ -# 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::Mailers::InviteUserByEmail do +describe Jobs::Mail::InviteUserByEmail do before do @sender = alice @email = 'bob@bob.com' @@ -16,6 +12,6 @@ describe Jobs::Mailers::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::Mailers::InviteUserByEmail.perform(invitation.id) + Jobs::Mail::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 f4b4ec0a2..e380dba33 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::Mailers::Mentioned do +describe Jobs::Mail::Mentioned do describe '#perfom' do it 'should call .deliver on the notifier object' do user = alice @@ -15,7 +15,7 @@ describe Jobs::Mailers::Mentioned do mail_mock.should_receive(:deliver) Notifier.should_receive(:mentioned).with(user.id, sm.author.id, m.id).and_return(mail_mock) - Jobs::Mailers::Mentioned.perform(user.id, sm.author.id, m.id) + Jobs::Mail::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 05bcf3c6f..5de3328e9 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::Mailers::PrivateMessage do +describe Jobs::Mail::PrivateMessage do describe '#perfom_delegate' do it 'should call .deliver on the notifier object' do user1 = alice @@ -21,7 +21,7 @@ describe Jobs::Mailers::PrivateMessage do mail_mock.should_receive(:deliver) Notifier.should_receive(:mentioned).with(user2.id, user1.person.id, message.id).and_return(mail_mock) - Jobs::Mailers::Mentioned.perform(user2.id, user1.person.id, message.id) + Jobs::Mail::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 e8c21b195..39d0693ee 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::Mailers::Reshared do +describe Jobs::Mail::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::Mailers::Reshared do mail_mock.should_receive(:deliver) Notifier.should_receive(:reshared).with(bob.id, reshare.author.id, reshare.id).and_return(mail_mock) - Jobs::Mailers::Reshared.perform(bob.id, reshare.author.id, reshare.id) + Jobs::Mail::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 fb2596c91..2138a7e73 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::Mailers::StartedSharing, alice.id, 'contactrequestid').once - alice.mail(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid') + Resque.should_receive(:enqueue).with(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid').once + alice.mail(Jobs::Mail::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::Mailers::StartedSharing, alice.id, 'contactrequestid') + alice.mail(Jobs::Mail::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::Mailers::StartedSharing, alice.id, 'contactrequestid') + alice.mail(Jobs::Mail::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::Mailers::ConfirmEmail, alice.id).once + Resque.should_receive(:enqueue).with(Jobs::Mail::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::Mailers::ConfirmEmail, alice.id) + Resque.should_not_receive(:enqueue).with(Jobs::Mail::ConfirmEmail, alice.id) alice.mail_confirm_email.should eql(false) end end