@@ -0,0 +1,40 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe AdministratorNotifications::ChannelNotificationsMailer, type: :mailer do
|
||||
let(:class_instance) { described_class.new }
|
||||
let!(:account) { create(:account) }
|
||||
let!(:administrator) { create(:user, :administrator, email: 'agent1@example.com', account: account) }
|
||||
|
||||
before do
|
||||
allow(described_class).to receive(:new).and_return(class_instance)
|
||||
allow(class_instance).to receive(:smtp_config_set_or_development?).and_return(true)
|
||||
end
|
||||
|
||||
describe 'slack_disconnect' do
|
||||
let(:mail) { described_class.with(account: account).slack_disconnect.deliver_now }
|
||||
|
||||
it 'renders the subject' do
|
||||
expect(mail.subject).to eq('Your Slack integration has expired')
|
||||
end
|
||||
|
||||
it 'renders the receiver email' do
|
||||
expect(mail.to).to eq([administrator.email])
|
||||
end
|
||||
end
|
||||
|
||||
describe 'facebook_disconnect' do
|
||||
let!(:facebook_channel) { create(:channel_facebook_page, account: account) }
|
||||
let!(:facebook_inbox) { create(:inbox, channel: facebook_channel, account: account) }
|
||||
let(:mail) { described_class.with(account: account).facebook_disconnect(facebook_inbox).deliver_now }
|
||||
|
||||
it 'renders the subject' do
|
||||
expect(mail.subject).to eq('Your Facebook page connection has expired')
|
||||
end
|
||||
|
||||
it 'renders the receiver email' do
|
||||
expect(mail.to).to eq([administrator.email])
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -14,7 +14,7 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile
|
||||
end
|
||||
|
||||
describe 'conversation_creation' do
|
||||
let(:mail) { described_class.conversation_creation(conversation, agent).deliver_now }
|
||||
let(:mail) { described_class.with(account: account).conversation_creation(conversation, agent).deliver_now }
|
||||
|
||||
it 'renders the subject' do
|
||||
expect(mail.subject).to eq("#{agent.available_name}, A new conversation [ID - #{conversation
|
||||
@@ -27,7 +27,7 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile
|
||||
end
|
||||
|
||||
describe 'conversation_assignment' do
|
||||
let(:mail) { described_class.conversation_assignment(conversation, agent).deliver_now }
|
||||
let(:mail) { described_class.with(account: account).conversation_assignment(conversation, agent).deliver_now }
|
||||
|
||||
it 'renders the subject' do
|
||||
expect(mail.subject).to eq("#{agent.available_name}, A new conversation [ID - #{conversation.display_id}] has been assigned to you.")
|
||||
@@ -40,7 +40,7 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile
|
||||
|
||||
describe 'conversation_mention' do
|
||||
let(:message) { create(:message, conversation: conversation, account: account) }
|
||||
let(:mail) { described_class.conversation_mention(message, agent).deliver_now }
|
||||
let(:mail) { described_class.with(account: account).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}]")
|
||||
@@ -53,7 +53,7 @@ RSpec.describe AgentNotifications::ConversationNotificationsMailer, type: :maile
|
||||
|
||||
describe 'assigned_conversation_new_message' do
|
||||
let(:message) { create(:message, conversation: conversation, account: account) }
|
||||
let(:mail) { described_class.assigned_conversation_new_message(message, agent).deliver_now }
|
||||
let(:mail) { described_class.with(account: account).assigned_conversation_new_message(message, agent).deliver_now }
|
||||
|
||||
it 'renders the subject' do
|
||||
expect(mail.subject).to eq("#{agent.available_name}, New message in your assigned conversation [ID - #{message.conversation.display_id}].")
|
||||
|
||||
Reference in New Issue
Block a user