2018-10-16 08:45:15 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Trigger do
|
|
|
|
|
|
|
|
describe 'sms' do
|
|
|
|
|
|
|
|
it 'sends interpolated, html-free SMS' do
|
|
|
|
agent = create(:agent_user)
|
|
|
|
another_agent = create(:admin_user, mobile: '+37061010000')
|
|
|
|
Group.lookup(id: 1).users << another_agent
|
|
|
|
|
|
|
|
channel = create(:channel, area: 'Sms::Notification')
|
|
|
|
trigger = create(:trigger,
|
|
|
|
disable_notification: false,
|
2018-12-19 17:31:51 +00:00
|
|
|
perform: {
|
2018-10-16 08:45:15 +00:00
|
|
|
'notification.sms': {
|
|
|
|
recipient: 'ticket_agents',
|
|
|
|
body: 'space between #{ticket.title}', # rubocop:disable Lint/InterpolationCheck
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
2019-02-04 06:56:18 +00:00
|
|
|
ticket = create(:ticket, group: Group.lookup(id: 1), created_by_id: agent.id)
|
2018-10-16 08:45:15 +00:00
|
|
|
Observer::Transaction.commit
|
|
|
|
|
|
|
|
triggered_article = Ticket::Article.last
|
|
|
|
|
2019-04-15 01:41:17 +00:00
|
|
|
expect(triggered_article.body).to match(/space between/)
|
|
|
|
expect(triggered_article.body).to match(ticket.title)
|
2018-10-16 08:45:15 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|