merge_spec.rb 630 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe '.merge', searchindex: true, type: :model do
  4. let(:user_1) { create(:agent, groups: Group.all) }
  5. let(:user_2) { create(:agent, groups: Group.all) }
  6. let(:ticket_1) do
  7. ticket = create(:ticket, owner: user_1, group: Group.first)
  8. create(:mention, mentionable: ticket, user: user_1)
  9. create(:mention, mentionable: ticket, user: user_2)
  10. ticket
  11. end
  12. before do
  13. user_1
  14. user_2
  15. ticket_1
  16. end
  17. it 'does merge users' do
  18. expect { user_2.merge(user_1.id) }.not_to raise_error
  19. end
  20. end