feat: Ability to specify a subject line for outbound emails (#3168)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user