* . * . * . * snapshot * whoops * halifax * tests * little fixes * little fixes * test? i guess.. * . * minor fixes * Update schema.rb * Use shared logo_design in new org partial * little fix * Fix org spec * decrayonsifying rich-selector * if statement Co-authored-by: rhymes <rhymesete@gmail.com>
27 lines
856 B
Ruby
27 lines
856 B
Ruby
require "rails_helper"
|
|
|
|
RSpec.describe "User destroys their profile", type: :system, js: true do
|
|
let(:user) { create(:user, saw_onboarding: true) }
|
|
|
|
before do
|
|
sign_in user
|
|
end
|
|
|
|
it "requests self-destroy" do
|
|
visit "/settings/account"
|
|
allow(Users::RequestDestroy).to receive(:call).and_call_original
|
|
click_button "Delete Account"
|
|
expect(Users::RequestDestroy).to have_received(:call).with(user)
|
|
end
|
|
|
|
it "destroys an account" do
|
|
token = SecureRandom.hex(10)
|
|
allow(Rails.cache).to receive(:read).and_return(token)
|
|
visit "/users/confirm_destroy/#{token}"
|
|
fill_in "delete__account__username__field", with: user.username
|
|
fill_in "delete__account__verification__field", with: "delete my account"
|
|
sidekiq_assert_enqueued_with(job: Users::DeleteWorker) do
|
|
click_button "DELETE ACCOUNT"
|
|
end
|
|
end
|
|
end
|