Spec for private messages not to be included in mails (#837)
This commit is contained in:
parent
a75f49ddcc
commit
1a123a4f56
1 changed files with 17 additions and 1 deletions
|
@ -12,15 +12,31 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
|
|||
allow(class_instance).to receive(:smtp_config_set_or_development?).and_return(true)
|
||||
end
|
||||
|
||||
context 'when custom domain and email is not enabled' do
|
||||
context 'with all mails' do
|
||||
let(:conversation) { create(:conversation, assignee: agent) }
|
||||
let(:message) { create(:message, conversation: conversation) }
|
||||
let(:private_message) { create(:message, content: 'This is a private message', private: true, conversation: conversation) }
|
||||
let(:mail) { described_class.reply_with_summary(message.conversation, Time.zone.now).deliver_now }
|
||||
|
||||
it 'renders the subject' do
|
||||
expect(mail.subject).to eq("[##{message.conversation.display_id}] #{message.content.truncate(30)}")
|
||||
end
|
||||
|
||||
it 'not have private notes' do
|
||||
# make the message private
|
||||
private_message.private = true
|
||||
private_message.save
|
||||
|
||||
expect(mail.body.decoded).not_to include(private_message.content)
|
||||
expect(mail.body.decoded).to include(message.content)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when custom domain and email is not enabled' do
|
||||
let(:conversation) { create(:conversation, assignee: agent) }
|
||||
let(:message) { create(:message, conversation: conversation) }
|
||||
let(:mail) { described_class.reply_with_summary(message.conversation, Time.zone.now).deliver_now }
|
||||
|
||||
it 'renders the receiver email' do
|
||||
expect(mail.to).to eq([message&.conversation&.contact&.email])
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue