feat: Tag agents in a private note (#1688)

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Pranav Raj S
2021-01-27 00:04:11 +05:30
committed by GitHub
parent b894b13e14
commit b93388b330
20 changed files with 424 additions and 93 deletions

View File

@@ -4,8 +4,9 @@ require 'rails_helper'
RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :mailer do
let(:class_instance) { described_class.new }
let(:agent) { create(:user, email: 'agent1@example.com') }
let(:conversation) { create(:conversation, assignee: agent) }
let!(:account) { create(:account) }
let(:agent) { create(:user, email: 'agent1@example.com', account: account) }
let(:conversation) { create(:conversation, assignee: agent, account: account) }
before do
allow(described_class).to receive(:new).and_return(class_instance)
@@ -37,6 +38,19 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile
end
end
describe 'conversation_mention' do
let(:message) { create(:message, conversation: conversation, account: account) }
let(:mail) { described_class.conversation_mention(message, agent).deliver_now }
it 'renders the subject' do
expect(mail.subject).to eq("#{agent.available_name}, You have been mentioned in conversation [ID - #{conversation.display_id}]")
end
it 'renders the receiver email' do
expect(mail.to).to eq([agent.email])
end
end
describe 'assigned_conversation_new_message' do
let(:mail) { described_class.assigned_conversation_new_message(conversation, agent).deliver_now }