Test erased reason from the user's point of view
What users care about isn't the database; they care about that reason being displayed when administrators check the reason. This way we also avoid accessing the database after the process running the browser has been started.
This commit is contained in:
@@ -71,8 +71,9 @@ describe "Users" do
|
||||
|
||||
scenario "Delete a level 2 user account from document verification page" do
|
||||
level_2_user = create(:user, :level_two, document_number: "12345678Z")
|
||||
manager = create(:manager)
|
||||
|
||||
login_as_manager
|
||||
login_as_manager(manager)
|
||||
visit management_document_verifications_path
|
||||
fill_in "document_verification_document_number", with: "12345678Z"
|
||||
click_button "Check document"
|
||||
@@ -85,12 +86,19 @@ describe "Users" do
|
||||
|
||||
expect(page).to have_content "User account deleted."
|
||||
|
||||
expect(level_2_user.reload.erase_reason).to eq "Deleted by manager: manager_user_#{Manager.last.user_id}"
|
||||
|
||||
visit management_document_verifications_path
|
||||
fill_in "document_verification_document_number", with: "12345678Z"
|
||||
click_button "Check document"
|
||||
|
||||
expect(page).to have_content "no user account associated to it"
|
||||
|
||||
logout
|
||||
login_as(create(:administrator).user)
|
||||
|
||||
visit admin_users_path(filter: "erased")
|
||||
|
||||
within "tr", text: level_2_user.id do
|
||||
expect(page).to have_content "Deleted by manager: manager_user_#{manager.user_id}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user