FIX: user destroyer spec (#11567)

Don't user @user and @admin after https://github.com/discourse/discourse/commit/db235c5ff92
This commit is contained in:
Krzysztof Kotlarek 2020-12-23 15:45:53 +11:00 committed by GitHub
parent 32ff52dd42
commit edf4e8b788
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -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)