discourse-follow/spec/integration/user_destroyer_spec.rb
Jarek Radosz 53df1f230c
DEV: Update linting and add types (#167)
* DEV: Update linting and add types

* DEV: Update linting and add types

* DEV: Update linting and add types
2026-01-28 11:49:36 +00:00

24 lines
766 B
Ruby

# frozen_string_literal: true
describe "User destroyer with the follow plugin" do
let(:user_a) { Fabricate(:user) }
let(:user_b) { Fabricate(:user) }
let(:user_c) { Fabricate(:user) }
before do
SiteSetting.discourse_follow_enabled = true
Jobs.run_immediately!
Follow::Updater.new(user_a, user_b).watch_follow
Follow::Updater.new(user_c, user_a).watch_follow
end
it "deletes all the follower and following relationships of the user being deleted" do
UserDestroyer.new(Discourse.system_user).destroy(user_a)
user_b.reload
user_c.reload
expect(user_b.id).to be_present
expect(user_c.id).to be_present
expect(user_b.follower_relations.count).to eq(0)
expect(user_c.following_relations.count).to eq(0)
end
end