avoid redirection to a deleted user
This commit is contained in:
parent
8e2122cb62
commit
a0c0520502
2 changed files with 5 additions and 2 deletions
|
@ -13,13 +13,14 @@ module Manager
|
|||
else
|
||||
flash[:error] = user.errors.full_messages.to_sentence
|
||||
end
|
||||
|
||||
redirect_to edit_manager_user_path(user)
|
||||
else
|
||||
targeted_user.merge(user)
|
||||
|
||||
flash[:notice] = "Le compte « #{targeted_email} » a absorbé le compte « #{user.email} »."
|
||||
redirect_to edit_manager_user_path(targeted_user)
|
||||
end
|
||||
|
||||
redirect_to edit_manager_user_path(user)
|
||||
end
|
||||
|
||||
def resend_confirmation_instructions
|
||||
|
|
|
@ -29,6 +29,7 @@ describe Manager::UsersController, type: :controller do
|
|||
subject
|
||||
|
||||
expect(User.find_by(id: user.id).email).to eq(nouvel_email)
|
||||
expect(response).to redirect_to(edit_manager_user_path(user))
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,6 +55,7 @@ describe Manager::UsersController, type: :controller do
|
|||
subject
|
||||
|
||||
expect(flash[:notice]).to match("Le compte « email.existant@domaine.fr » a absorbé le compte « ancien.email@domaine.fr ».")
|
||||
expect(response).to redirect_to(edit_manager_user_path(targeted_user))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue