From edf4e8b788b90738c0af7b5d9130312a6dfac353 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Wed, 23 Dec 2020 15:45:53 +1100 Subject: [PATCH] FIX: user destroyer spec (#11567) Don't user @user and @admin after https://github.com/discourse/discourse/commit/db235c5ff92 --- spec/services/user_destroyer_spec.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/services/user_destroyer_spec.rb b/spec/services/user_destroyer_spec.rb index f3791681162..c54ff7a0948 100644 --- a/spec/services/user_destroyer_spec.rb +++ b/spec/services/user_destroyer_spec.rb @@ -213,13 +213,13 @@ describe UserDestroyer do end context 'user created category' do - let!(:topic) { Fabricate(:topic, user: @user) } - let!(:first_post) { Fabricate(:post, user: @user, topic: topic) } - let!(:second_post) { Fabricate(:post, user: @user, topic: topic) } - let!(:category) { Fabricate(:category, user: @user, topic_id: topic.id) } + let!(:topic) { Fabricate(:topic, user: user) } + let!(:first_post) { Fabricate(:post, user: user, topic: topic) } + let!(:second_post) { Fabricate(:post, user: user, topic: topic) } + let!(:category) { Fabricate(:category, user: user, topic_id: topic.id) } it 'changes author of first category post to system user and still deletes second post' do - UserDestroyer.new(@admin).destroy(@user, delete_posts: true) + UserDestroyer.new(admin).destroy(user, delete_posts: true) expect(first_post.reload.deleted_at).to eq(nil) expect(first_post.user_id).to eq(Discourse.system_user.id)