If a post is flagged after an action was already performed on it, it will update the previous Reviable instance and not create a new one. The notification logic was implemented in the :create callback which was completely skipped in this case.
You’ve signed the CLA, udan11. Thank you! This pull request is ready for review.
We want to avoid using stubs and mocks in our test suite as much as possible. In the test environment, Sidekiq jobs are pushed into an array that can be accessed via the class. Example:
Jobs::NotifyReviewable.jobs. This is a good read as well Testing · mperham/sidekiq Wiki · GitHub. I’ve cleaned up the existing mocks in DEV: Remove mocks from tests. · discourse/discourse@32b4bda · GitHub so you can use that as a reference
all the mocks (cf. @tgxworld’s comment)