mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
Feature: Conversation creation email notifications (#576)
* Clean up the mailers * Disable assignment mailer if setting is turned off * Email notifications on conversation create * Specs
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
require 'rails_helper'
|
||||
|
||||
Sidekiq::Testing.fake!
|
||||
RSpec.describe ConversationEmailWorker, type: :worker do
|
||||
RSpec.describe ConversationReplyEmailWorker, type: :worker do
|
||||
let(:perform_at) { (Time.zone.today + 6.hours).to_datetime }
|
||||
let(:scheduled_job) { described_class.perform_at(perform_at, 1, Time.zone.now) }
|
||||
let(:conversation) { build(:conversation, display_id: nil) }
|
||||
|
||||
describe 'testing ConversationEmailWorker' do
|
||||
describe 'testing ConversationSummaryEmailWorker' do
|
||||
before do
|
||||
conversation.save!
|
||||
allow(Conversation).to receive(:find).and_return(conversation)
|
||||
mailer = double
|
||||
allow(ConversationMailer).to receive(:new_message).and_return(mailer)
|
||||
allow(ConversationReplyMailer).to receive(:reply_with_summary).and_return(mailer)
|
||||
allow(mailer).to receive(:deliver_later).and_return(true)
|
||||
end
|
||||
|
||||
@@ -28,9 +28,9 @@ RSpec.describe ConversationEmailWorker, type: :worker do
|
||||
end
|
||||
|
||||
context 'with actions performed by the worker' do
|
||||
it 'calls ConversationMailer' do
|
||||
it 'calls ConversationSummaryMailer' do
|
||||
described_class.new.perform(1, Time.zone.now)
|
||||
expect(ConversationMailer).to have_received(:new_message)
|
||||
expect(ConversationReplyMailer).to have_received(:reply_with_summary)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user