feat: Ability to specify a subject line for outbound emails (#3168)

This commit is contained in:
Aswin Dev P.S
2021-10-27 13:09:29 +05:30
committed by GitHub
parent 2f2d2b4f73
commit 46867e89cb
6 changed files with 83 additions and 14 deletions

View File

@@ -25,6 +25,15 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
bcc_emails: 'agent_bcc1@example.com'
})
end
let(:new_message) do
create(:message,
account: account,
conversation: conversation,
content_attributes: {
cc_emails: 'agent_cc2@example.com',
bcc_emails: 'agent_bcc2@example.com'
})
end
let(:cc_message) do
create(:message,
account: account,
@@ -39,10 +48,17 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
let(:mail) { described_class.reply_with_summary(message.conversation, message.id).deliver_now }
let(:cc_mail) { described_class.reply_with_summary(cc_message.conversation, message.id).deliver_now }
it 'renders the subject' do
it 'renders the default subject' do
expect(mail.subject).to eq("[##{message.conversation.display_id}] New messages on this conversation")
end
it 'renders the subject in conversation as reply' do
conversation.additional_attributes = { 'mail_subject': 'Mail Subject' }
conversation.save
new_message.save
expect(mail.subject).to eq('Re: Mail Subject')
end
it 'not have private notes' do
# make the message private
private_message.private = true
@@ -91,10 +107,16 @@ RSpec.describe ConversationReplyMailer, type: :mailer do
message_2.save
end
it 'renders the subject' do
it 'renders the default subject' do
expect(mail.subject).to eq("[##{message_2.conversation.display_id}] New messages on this conversation")
end
it 'renders the subject in conversation' do
conversation.additional_attributes = { 'mail_subject': 'Mail Subject' }
conversation.save
expect(mail.subject).to eq('Mail Subject')
end
it 'not have private notes' do
# make the message private
private_message.private = true