Created
June 2, 2017 13:44
-
-
Save nateberkopec/3932fce995c9feddd411417fc9bf33bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ever felt like your unit test suite was just too zippy? Slow that shit down immediately | |
# by running hundreds of jobs which have nothing to do with the behavior under test! | |
# This works even better if you have Sidekiq jobs enqueued in ActiveRecord callbacks! | |
module Sidekiq | |
class Testing | |
class << self | |
alias_method :my_tests_are_too_fast!, :inline! | |
end | |
end | |
end | |
# If you want faster tests (ew, who would want that? deviants.) you can use fake | |
# mode and call WorkerWhoseBehaviorIsUnderTest.drain, which will block until all | |
# enqueued jobs for that worker are processed. But that sounds hard, and adding | |
# Sidekiq::Testing.inline! to your test_helper is easy! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment