Revert "change namespace from Mail to Mailers"
This reverts commit f859904c76.
This commit is contained in:
parent
f859904c76
commit
f6845c360f
38 changed files with 53 additions and 144 deletions
|
|
@ -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
|
module NotificationMailers
|
||||||
class AlsoCommented < NotificationMailers::Base
|
class AlsoCommented < NotificationMailers::Base
|
||||||
include ActionView::Helpers::TextHelper
|
include ActionView::Helpers::TextHelper
|
||||||
|
|
|
||||||
|
|
@ -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
|
module NotificationMailers
|
||||||
TRUNCATION_LEN = 70
|
TRUNCATION_LEN = 70
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
module NotificationMailers
|
||||||
class CommentOnPost < NotificationMailers::Base
|
class CommentOnPost < NotificationMailers::Base
|
||||||
include ActionView::Helpers::TextHelper
|
include ActionView::Helpers::TextHelper
|
||||||
|
|
|
||||||
|
|
@ -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
|
module NotificationMailers
|
||||||
class ConfirmEmail < NotificationMailers::Base
|
class ConfirmEmail < NotificationMailers::Base
|
||||||
def set_headers
|
def set_headers
|
||||||
|
|
|
||||||
|
|
@ -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
|
module NotificationMailers
|
||||||
class Liked < NotificationMailers::Base
|
class Liked < NotificationMailers::Base
|
||||||
attr_accessor :like
|
attr_accessor :like
|
||||||
|
|
|
||||||
|
|
@ -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
|
module NotificationMailers
|
||||||
class Mentioned < NotificationMailers::Base
|
class Mentioned < NotificationMailers::Base
|
||||||
attr_accessor :post
|
attr_accessor :post
|
||||||
|
|
|
||||||
|
|
@ -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
|
module NotificationMailers
|
||||||
class PrivateMessage < NotificationMailers::Base
|
class PrivateMessage < NotificationMailers::Base
|
||||||
attr_accessor :message, :conversation, :participants
|
attr_accessor :message, :conversation, :participants
|
||||||
|
|
|
||||||
|
|
@ -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
|
module NotificationMailers
|
||||||
class Reshared < NotificationMailers::Base
|
class Reshared < NotificationMailers::Base
|
||||||
attr_accessor :reshare
|
attr_accessor :reshare
|
||||||
|
|
|
||||||
|
|
@ -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
|
module NotificationMailers
|
||||||
class StartedSharing < NotificationMailers::Base
|
class StartedSharing < NotificationMailers::Base
|
||||||
def set_headers
|
def set_headers
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifier < ActionMailer::Base
|
||||||
helper :application
|
helper :application
|
||||||
helper :markdownify
|
helper :markdownify
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ class Invitation < ActiveRecord::Base
|
||||||
|
|
||||||
def queue_send!
|
def queue_send!
|
||||||
unless self.recipient.present?
|
unless self.recipient.present?
|
||||||
Resque.enqueue(Jobs::Mailers::InviteUserByEmail, self.id)
|
Resque.enqueue(Jobs::Mail::InviteUserByEmail, self.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class Base
|
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
|
extend ResqueJobLogging
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -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 Jobs
|
||||||
module Mailers
|
module Mail
|
||||||
class AlsoCommented < Base
|
class AlsoCommented < Base
|
||||||
@queue = :mail
|
@queue = :mail
|
||||||
def self.perform(recipient_id, sender_id, comment_id)
|
def self.perform(recipient_id, sender_id, comment_id)
|
||||||
|
|
@ -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 Jobs
|
||||||
module Mailers
|
module Mail
|
||||||
class CommentOnPost < Base
|
class CommentOnPost < Base
|
||||||
@queue = :mail
|
@queue = :mail
|
||||||
def self.perform(recipient_id, sender_id, comment_id)
|
def self.perform(recipient_id, sender_id, comment_id)
|
||||||
10
app/models/jobs/mail/confirm_email.rb
Normal file
10
app/models/jobs/mail/confirm_email.rb
Normal file
|
|
@ -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
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
module Mailers
|
module Mail
|
||||||
class InviteUserByEmail < Base
|
class InviteUserByEmail < Base
|
||||||
@queue = :mail
|
@queue = :mail
|
||||||
def self.perform(invite_id)
|
def self.perform(invite_id)
|
||||||
|
|
@ -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 Jobs
|
||||||
module Mailers
|
module Mail
|
||||||
class Liked < Base
|
class Liked < Base
|
||||||
@queue = :mail
|
@queue = :mail
|
||||||
def self.perform(recipient_id, sender_id, like_id)
|
def self.perform(recipient_id, sender_id, like_id)
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
module Mailers
|
module Mail
|
||||||
class Mentioned < Base
|
class Mentioned < Base
|
||||||
@queue = :mail
|
@queue = :mail
|
||||||
def self.perform(recipient_id, actor_id, target_id)
|
def self.perform(recipient_id, actor_id, target_id)
|
||||||
|
|
@ -2,10 +2,11 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
module Mailers
|
module Mail
|
||||||
class PrivateMessage < Base
|
class PrivateMessage < Base
|
||||||
@queue = :mailers
|
@queue = :mail
|
||||||
def self.perform(recipient_id, actor_id, target_id)
|
def self.perform(recipient_id, actor_id, target_id)
|
||||||
Notifier.private_message( recipient_id, actor_id, target_id).deliver
|
Notifier.private_message( recipient_id, actor_id, target_id).deliver
|
||||||
end
|
end
|
||||||
|
|
@ -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 Jobs
|
||||||
module Mailers
|
module Mail
|
||||||
class Reshared < Base
|
class Reshared < Base
|
||||||
@queue = :mail
|
@queue = :mail
|
||||||
def self.perform(recipient_id, sender_id, reshare_id)
|
def self.perform(recipient_id, sender_id, reshare_id)
|
||||||
|
|
@ -2,8 +2,9 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
module Mailers
|
module Mail
|
||||||
class StartedSharing < Base
|
class StartedSharing < Base
|
||||||
@queue = :mail
|
@queue = :mail
|
||||||
def self.perform(recipient_id, sender_id, target_id)
|
def self.perform(recipient_id, sender_id, target_id)
|
||||||
|
|
@ -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
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
# licensed under the Affero General Public License version 3 or later. See
|
# licensed under the Affero General Public License version 3 or later. See
|
||||||
# the COPYRIGHT file.
|
# the COPYRIGHT file.
|
||||||
|
|
||||||
|
|
||||||
module Jobs
|
module Jobs
|
||||||
class ResendInvitation < Base
|
class ResendInvitation < Base
|
||||||
@queue = :mail
|
@queue = :mail
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifications::AlsoCommented < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Jobs::Mailers::AlsoCommented
|
Jobs::Mail::AlsoCommented
|
||||||
end
|
end
|
||||||
|
|
||||||
def popup_translation_key
|
def popup_translation_key
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifications::CommentOnPost < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Jobs::Mailers::CommentOnPost
|
Jobs::Mail::CommentOnPost
|
||||||
end
|
end
|
||||||
|
|
||||||
def popup_translation_key
|
def popup_translation_key
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifications::Liked < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Jobs::Mailers::Liked
|
Jobs::Mail::Liked
|
||||||
end
|
end
|
||||||
|
|
||||||
def popup_translation_key
|
def popup_translation_key
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifications::Mentioned < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Jobs::Mailers::Mentioned
|
Jobs::Mail::Mentioned
|
||||||
end
|
end
|
||||||
|
|
||||||
def popup_translation_key
|
def popup_translation_key
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifications::PrivateMessage < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Jobs::Mailers::PrivateMessage
|
Jobs::Mail::PrivateMessage
|
||||||
end
|
end
|
||||||
def popup_translation_key
|
def popup_translation_key
|
||||||
'notifications.private_message'
|
'notifications.private_message'
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifications::RequestAccepted < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Jobs::Mailers::RequestAcceptance
|
Jobs::Mail::RequestAcceptance
|
||||||
end
|
end
|
||||||
def popup_translation_key
|
def popup_translation_key
|
||||||
'notifications.request_accepted'
|
'notifications.request_accepted'
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifications::Reshared < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Jobs::Mailers::Reshared
|
Jobs::Mail::Reshared
|
||||||
|
#Jobs::Mail::Liked
|
||||||
end
|
end
|
||||||
|
|
||||||
def popup_translation_key
|
def popup_translation_key
|
||||||
|
|
|
||||||
|
|
@ -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
|
class Notifications::StartedSharing < Notification
|
||||||
def mail_job
|
def mail_job
|
||||||
Jobs::Mailers::StartedSharing
|
Jobs::Mail::StartedSharing
|
||||||
end
|
end
|
||||||
|
|
||||||
def popup_translation_key
|
def popup_translation_key
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
######### Mailer #######################
|
######### Mailer #######################
|
||||||
def mail(job, *args)
|
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))
|
if(self.disable_mail == false && !self.user_preferences.exists?(:email_type => pref))
|
||||||
Resque.enqueue(job, *args)
|
Resque.enqueue(job, *args)
|
||||||
end
|
end
|
||||||
|
|
@ -275,7 +275,7 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
def mail_confirm_email
|
def mail_confirm_email
|
||||||
return false if unconfirmed_email.blank?
|
return false if unconfirmed_email.blank?
|
||||||
Resque.enqueue(Jobs::Mailers::ConfirmEmail, id)
|
Resque.enqueue(Jobs::Mail::ConfirmEmail, id)
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ describe UsersController do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'sends out activation email on success' do
|
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"})
|
put(:update, :id => @user.id, :user => { :email => "my@newemail.com"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -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'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Jobs::Mailers::InviteUserByEmail do
|
describe Jobs::Mail::InviteUserByEmail do
|
||||||
before do
|
before do
|
||||||
@sender = alice
|
@sender = alice
|
||||||
@email = 'bob@bob.com'
|
@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 = Invitation.create(:sender => @sender, :identifier => @email, :service => "email", :aspect => @aspect, :message => @message)
|
||||||
invitation.should_receive(:send!)
|
invitation.should_receive(:send!)
|
||||||
Invitation.stub(:find).and_return(invitation)
|
Invitation.stub(:find).and_return(invitation)
|
||||||
Jobs::Mailers::InviteUserByEmail.perform(invitation.id)
|
Jobs::Mail::InviteUserByEmail.perform(invitation.id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Jobs::Mailers::Mentioned do
|
describe Jobs::Mail::Mentioned do
|
||||||
describe '#perfom' do
|
describe '#perfom' do
|
||||||
it 'should call .deliver on the notifier object' do
|
it 'should call .deliver on the notifier object' do
|
||||||
user = alice
|
user = alice
|
||||||
|
|
@ -15,7 +15,7 @@ describe Jobs::Mailers::Mentioned do
|
||||||
mail_mock.should_receive(:deliver)
|
mail_mock.should_receive(:deliver)
|
||||||
Notifier.should_receive(:mentioned).with(user.id, sm.author.id, m.id).and_return(mail_mock)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Jobs::Mailers::PrivateMessage do
|
describe Jobs::Mail::PrivateMessage do
|
||||||
describe '#perfom_delegate' do
|
describe '#perfom_delegate' do
|
||||||
it 'should call .deliver on the notifier object' do
|
it 'should call .deliver on the notifier object' do
|
||||||
user1 = alice
|
user1 = alice
|
||||||
|
|
@ -21,7 +21,7 @@ describe Jobs::Mailers::PrivateMessage do
|
||||||
mail_mock.should_receive(:deliver)
|
mail_mock.should_receive(:deliver)
|
||||||
Notifier.should_receive(:mentioned).with(user2.id, user1.person.id, message.id).and_return(mail_mock)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Jobs::Mailers::Reshared do
|
describe Jobs::Mail::Reshared do
|
||||||
describe '#perfom' do
|
describe '#perfom' do
|
||||||
it 'should call .deliver on the notifier object' do
|
it 'should call .deliver on the notifier object' do
|
||||||
sm = Factory(:status_message, :author => bob.person, :public => true)
|
sm = Factory(:status_message, :author => bob.person, :public => true)
|
||||||
|
|
@ -14,7 +14,7 @@ describe Jobs::Mailers::Reshared do
|
||||||
mail_mock.should_receive(:deliver)
|
mail_mock.should_receive(:deliver)
|
||||||
Notifier.should_receive(:reshared).with(bob.id, reshare.author.id, reshare.id).and_return(mail_mock)
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -661,14 +661,14 @@ describe User do
|
||||||
alice.disable_mail = false
|
alice.disable_mail = false
|
||||||
alice.save
|
alice.save
|
||||||
|
|
||||||
Resque.should_receive(:enqueue).with(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid').once
|
Resque.should_receive(:enqueue).with(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid').once
|
||||||
alice.mail(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid')
|
alice.mail(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not enqueue a mail job if the correct corresponding job has a prefrence entry' do
|
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')
|
alice.user_preferences.create(:email_type => 'started_sharing')
|
||||||
Resque.should_not_receive(:enqueue)
|
Resque.should_not_receive(:enqueue)
|
||||||
alice.mail(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid')
|
alice.mail(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not send a mail if disable_mail is set to true' do
|
it 'does not send a mail if disable_mail is set to true' do
|
||||||
|
|
@ -676,7 +676,7 @@ describe User do
|
||||||
alice.save
|
alice.save
|
||||||
alice.reload
|
alice.reload
|
||||||
Resque.should_not_receive(:enqueue)
|
Resque.should_not_receive(:enqueue)
|
||||||
alice.mail(Jobs::Mailers::StartedSharing, alice.id, 'contactrequestid')
|
alice.mail(Jobs::Mail::StartedSharing, alice.id, 'contactrequestid')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -823,12 +823,12 @@ describe User do
|
||||||
describe '#mail_confirm_email' do
|
describe '#mail_confirm_email' do
|
||||||
it 'enqueues a mail job on user with unconfirmed email' do
|
it 'enqueues a mail job on user with unconfirmed email' do
|
||||||
user.update_attribute(:unconfirmed_email, "alice@newmail.com")
|
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)
|
alice.mail_confirm_email.should eql(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'enqueues NO mail job on user without unconfirmed email' do
|
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)
|
alice.mail_confirm_email.should eql(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue