2013-09-20 17:39:11 -04:00
|
|
|
require 'sidekiq/testing'
|
2012-05-01 18:54:04 -04:00
|
|
|
|
2013-09-20 17:39:11 -04:00
|
|
|
##
|
|
|
|
# The Sidekiq inline infrastructure overrides perform_async so that it
|
|
|
|
# actually calls perform instead. This allows workers to be run inline in a
|
|
|
|
# testing environment.
|
|
|
|
#
|
|
|
|
# This is similar to `Resque.inline = true` functionality.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
#
|
|
|
|
# require 'sidekiq/testing/inline'
|
|
|
|
#
|
|
|
|
# $external_variable = 0
|
|
|
|
#
|
|
|
|
# class ExternalWorker
|
|
|
|
# include Sidekiq::Worker
|
|
|
|
#
|
|
|
|
# def perform
|
|
|
|
# $external_variable = 1
|
|
|
|
# end
|
|
|
|
# end
|
|
|
|
#
|
|
|
|
# assert_equal 0, $external_variable
|
|
|
|
# ExternalWorker.perform_async
|
|
|
|
# assert_equal 1, $external_variable
|
|
|
|
#
|
|
|
|
Sidekiq::Testing.inline!
|