models_spec.rb 669 B

12345678910111213141516171819202122232425
  1. require 'rails_helper'
  2. RSpec.describe Models do
  3. describe '.merge' do
  4. context 'when ExternalSync references are present' do
  5. shared_examples 'migrates entries' do |model|
  6. let(:factory_name) { model.downcase.to_sym }
  7. let(:source) { create(factory_name) }
  8. let(:target) { create(factory_name) }
  9. it 'sends ExternalSync.migrate' do
  10. allow(ExternalSync).to receive(:migrate)
  11. described_class.merge(model, source.id, target.id)
  12. expect(ExternalSync).to have_received(:migrate).with(model, source.id, target.id)
  13. end
  14. end
  15. it_behaves_like 'migrates entries', 'User'
  16. end
  17. end
  18. end