2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2020-07-20 06:19:51 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe Models do
|
|
|
|
|
|
|
|
describe '.merge' do
|
|
|
|
|
|
|
|
context 'when ExternalSync references are present' do
|
|
|
|
|
|
|
|
shared_examples 'migrates entries' do |model|
|
|
|
|
|
|
|
|
let(:factory_name) { model.downcase.to_sym }
|
|
|
|
let(:source) { create(factory_name) }
|
|
|
|
let(:target) { create(factory_name) }
|
|
|
|
|
|
|
|
it 'sends ExternalSync.migrate' do
|
|
|
|
allow(ExternalSync).to receive(:migrate)
|
|
|
|
described_class.merge(model, source.id, target.id)
|
|
|
|
expect(ExternalSync).to have_received(:migrate).with(model, source.id, target.id)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
it_behaves_like 'migrates entries', 'User'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|