* First draft - all the big changes * Changing some more references to 'internal' * Relocate internal request tests to admin * Relocate internal system tests to admin * Fix trailing space * Test fix * Move queries from internal to admin * Docs updates * Rename internal stimuls controllers to admin (plus docs) * Rename admin layout * Fix routing after rebase * Fixes for latest added admin interfaces * Serviceworker ignore paths
33 lines
1 KiB
Ruby
33 lines
1 KiB
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "Admin deletes user", type: :system do
|
|
let(:admin) { create(:user, :super_admin) }
|
|
let(:user) { create(:user) }
|
|
|
|
before do
|
|
sign_in admin
|
|
visit "/admin/users/#{user.id}/edit"
|
|
end
|
|
|
|
it "enqueues a job for deleting the user" do
|
|
sidekiq_assert_enqueued_jobs(1, only: Users::DeleteWorker) do
|
|
click_button "☠️ Fully Delete User & All Activity ☠️"
|
|
end
|
|
|
|
message = "@#{user.username} (email: #{user.email}, user_id: #{user.id}) has been fully deleted."
|
|
expect(page).to have_content(message)
|
|
end
|
|
|
|
# See: https://github.com/thepracticaldev/tech-private/issues/404
|
|
it "deletes users when they have no email address" do
|
|
user.update(email: nil)
|
|
|
|
sidekiq_perform_enqueued_jobs do
|
|
click_button "☠️ Fully Delete User & All Activity ☠️"
|
|
end
|
|
|
|
message = "@#{user.username} (email: no email, user_id: #{user.id}) has been fully deleted."
|
|
expect(page).to have_content(message)
|
|
expect(User.find_by(id: user.id)).to be_nil
|
|
end
|
|
end
|