chore: Add controllers for conversation participants (#6462)

Co-authored-by: Aswin Dev P.S <aswindevps@gmail.com>
Co-authored-by: Sojan Jose <sojan@chatwoot.com>
This commit is contained in:
Pranav Raj S
2023-02-15 16:33:31 -08:00
committed by GitHub
parent 949ddf68ba
commit 7044eda281
34 changed files with 546 additions and 63 deletions

View File

@@ -73,6 +73,10 @@ shared_examples_for 'assignment_handler' do
end
let(:assignment_mailer) { instance_double(AgentNotifications::ConversationNotificationsMailer, deliver: true) }
before do
create(:inbox_member, user: agent, inbox: conversation.inbox)
end
it 'assigns the agent to conversation' do
expect(update_assignee).to be(true)
expect(conversation.reload.assignee).to eq(agent)
@@ -85,6 +89,10 @@ shared_examples_for 'assignment_handler' do
expect(update_assignee).to be(true)
end
it 'adds assignee to conversation participants' do
expect { update_assignee }.to change { conversation.conversation_participants.count }.by(1)
end
context 'when agent is current user' do
before do
Current.user = agent