749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger# https://github.com/mperham/sidekiq/wiki/Testing
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger
816bf6f8088b162b681101d93fd450127a0e586fJulian Kornbergerrequire 'sidekiq/testing'
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger
749095632ff6cf20da6403ac398587db9f4c6b7eJulian KornbergerRSpec.configure do |config|
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger config.before(:each) do
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger # Clears out the jobs for tests using the fake testing
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger Sidekiq::Worker.clear_all
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger if example.metadata[:sidekiq] == :inline
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger Sidekiq::Testing.inline!
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger elsif example.metadata[:type] == :acceptance
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger Sidekiq::Testing.inline!
61467f8ae537212ba3c895868c91235a21985cb8Tim Reddehase elsif example.metadata[:needs_hets]
61467f8ae537212ba3c895868c91235a21985cb8Tim Reddehase Sidekiq::Testing.inline!
20d7141b5fbf4ea48eeadae9d6a9a88465ac6b8bTim Reddehase elsif example.metadata[:process_jobs_synchronously]
20d7141b5fbf4ea48eeadae9d6a9a88465ac6b8bTim Reddehase Sidekiq::Testing.inline!
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger else
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger Sidekiq::Testing.fake!
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger end
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornberger end
749095632ff6cf20da6403ac398587db9f4c6b7eJulian Kornbergerend