FIX: Generate webhook payloads before destroy events (#6325)

This commit is contained in:
Vinoth Kannan
2018-10-05 14:23:59 +05:30
committed by Guo Xiang Tan
parent 5b630f3188
commit 8430ea927e
11 changed files with 90 additions and 29 deletions

View File

@@ -20,6 +20,10 @@ RSpec.describe Jobs::FixPrimaryEmailsForStagedUsers do
UserEmail.delete_all
# since we removing `user_emails` table the `user.primary_email` value will be nil.
# it will raise error in https://github.com/discourse/discourse/blob/d0b027d88deeabf8bc105419f7d3fae0087091cd/app/models/user.rb#L942
WebHook.stubs(:generate_payload).returns(nil)
expect { described_class.new.execute_onceoff({}) }
.to change { User.count }.by(-2)
.and change { staged_user.posts.count }.by(3)