merge destroys the old role and account
This commit is contained in:
parent
1401d163ba
commit
f2ccb39912
2 changed files with 7 additions and 0 deletions
|
@ -208,6 +208,8 @@ class User < ApplicationRecord
|
|||
targeted_role.merge(old_role)
|
||||
end
|
||||
end
|
||||
|
||||
old_user.destroy
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -459,6 +459,11 @@ describe User, type: :model do
|
|||
expect(targeted_administrateur).to receive(:merge).with(administrateur)
|
||||
|
||||
subject
|
||||
|
||||
expect { instructeur.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
expect { expert.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
expect { administrateur.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
expect { old_user.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue