chore: Add event for conversations transferred to Bot (#2167)

* chore:  Event for conversation transferred to Bot

Co-authored-by: Muhsin Keloth <muhsinkeramam@gmail.com>
Co-authored-by: Nithin David <webofnithin@gmail.com>
This commit is contained in:
Sojan Jose
2021-04-28 20:53:23 +05:30
committed by GitHub
parent aa47bad4c1
commit 4b49d21543
13 changed files with 23 additions and 80 deletions

View File

@@ -93,7 +93,6 @@ RSpec.describe Conversation, type: :model do
conversation.update(
status: :resolved,
locked: true,
contact_last_seen_at: Time.now,
assignee: new_assignee,
label_list: [label.title]
@@ -106,8 +105,6 @@ RSpec.describe Conversation, type: :model do
.with(described_class::CONVERSATION_RESOLVED, kind_of(Time), conversation: conversation)
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
.with(described_class::CONVERSATION_READ, kind_of(Time), conversation: conversation)
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
.with(described_class::CONVERSATION_LOCK_TOGGLE, kind_of(Time), conversation: conversation)
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
.with(described_class::ASSIGNEE_CHANGED, kind_of(Time), conversation: conversation)
end
@@ -193,28 +190,6 @@ RSpec.describe Conversation, type: :model do
end
end
describe '#lock!' do
subject(:lock!) { conversation.lock! }
let(:conversation) { create(:conversation) }
it 'assigns locks the conversation' do
expect(lock!).to eq(true)
expect(conversation.reload.locked).to eq(true)
end
end
describe '#unlock!' do
subject(:unlock!) { conversation.unlock! }
let(:conversation) { create(:conversation) }
it 'unlocks the conversation' do
expect(unlock!).to eq(true)
expect(conversation.reload.locked).to eq(false)
end
end
describe '#mute!' do
subject(:mute!) { conversation.mute! }
@@ -365,18 +340,6 @@ RSpec.describe Conversation, type: :model do
end
end
describe '#lock_event_data' do
subject(:lock_event_data) { conversation.lock_event_data }
let(:conversation) do
build(:conversation, display_id: 505, locked: false)
end
it 'returns lock event payload' do
expect(lock_event_data).to eq(id: 505, locked: false)
end
end
describe '#botinbox: when conversation created inside inbox with agent bot' do
let!(:bot_inbox) { create(:agent_bot_inbox) }
let(:conversation) { create(:conversation, inbox: bot_inbox.inbox) }