merge move invite as well
This commit is contained in:
parent
f2ccb39912
commit
3328c9a132
2 changed files with 4 additions and 1 deletions
|
@ -196,6 +196,7 @@ class User < ApplicationRecord
|
|||
|
||||
def merge(old_user)
|
||||
old_user.dossiers.update_all(user_id: id)
|
||||
old_user.invites.update_all(user_id: id)
|
||||
|
||||
[
|
||||
[old_user.instructeur, instructeur],
|
||||
|
|
|
@ -424,13 +424,15 @@ describe User, type: :model do
|
|||
|
||||
subject { targeted_user.merge(old_user) }
|
||||
|
||||
context 'and the old account has a dossier' do
|
||||
context 'and the old account has some stuff' do
|
||||
let!(:dossier) { create(:dossier, user: old_user) }
|
||||
let!(:invite) { create(:invite, user: old_user) }
|
||||
|
||||
it 'transfers the dossier' do
|
||||
subject
|
||||
|
||||
expect(targeted_user.dossiers).to match([dossier])
|
||||
expect(targeted_user.invites).to match([invite])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue