2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2018-07-18 07:30:50 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Issue2019FixDoubleDomainLinksInTriggerEmails, type: :db_migration do
|
2019-01-29 14:04:47 +00:00
|
|
|
subject { create(:trigger, perform: { 'notification.email' => { 'body' => faulty_link, 'recipient' => 'customer', 'subject' => 'some subject' } }) }
|
2018-07-18 07:30:50 +00:00
|
|
|
|
2021-05-28 11:25:36 +00:00
|
|
|
# rubocop:disable Lint/InterpolationCheck
|
2018-07-18 07:30:50 +00:00
|
|
|
let(:faulty_link) do
|
|
|
|
'<a href="https://example.com/#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">' \
|
2021-07-12 13:18:31 +00:00
|
|
|
'View ticket' \
|
|
|
|
'</a>'
|
2018-07-18 07:30:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:fixed_link) do
|
|
|
|
'<a href="#{config.http_type}://#{config.fqdn}/#ticket/zoom/#{ticket.id}">' \
|
2021-07-12 13:18:31 +00:00
|
|
|
'View ticket' \
|
|
|
|
'</a>'
|
2018-07-18 07:30:50 +00:00
|
|
|
end
|
2021-05-28 11:25:36 +00:00
|
|
|
# rubocop:enable Lint/InterpolationCheck
|
2018-07-18 07:30:50 +00:00
|
|
|
|
|
|
|
it "removes duplicate domains from Trigger records' notification.email bodies" do
|
|
|
|
expect { migrate }.to change { subject.reload.perform['notification.email']['body'] }
|
|
|
|
.from(faulty_link).to(fixed_link)
|
|
|
|
end
|
|
|
|
end
|