Chatwoot/spec/services/line/send_on_line_service_spec.rb
Sojan Jose 0a38632f14
feat: Line Channel (#2904)
- Ability to configure line bots as a channel in chatwoot
- Receive a message sent to the line bot in chatwoot
- Ability to reply to line users from chatwoot

fixes: #2738
2021-09-11 01:31:17 +05:30

18 lines
685 B
Ruby

require 'rails_helper'
describe Line::SendOnLineService do
describe '#perform' do
context 'when a valid message' do
it 'calls @channel.client.push_message' do
line_client = double
line_channel = create(:channel_line)
message = create(:message, message_type: :outgoing, content: 'test',
conversation: create(:conversation, inbox: line_channel.inbox))
allow(line_client).to receive(:push_message)
allow(Line::Bot::Client).to receive(:new).and_return(line_client)
expect(line_client).to receive(:push_message)
described_class.new(message: message).perform
end
end
end
end