File: inline.rb

package info (click to toggle)
ruby-sidekiq 7.3.2%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 956 kB
  • sloc: ruby: 6,094; javascript: 526; makefile: 21; sh: 20
file content (30 lines) | stat: -rw-r--r-- 627 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# frozen_string_literal: true

require "sidekiq/testing"

##
# The Sidekiq inline infrastructure overrides perform_async so that it
# actually calls perform instead. This allows jobs 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 ExternalJob
#     include Sidekiq::Job
#
#     def perform
#       $external_variable = 1
#     end
#   end
#
#   assert_equal 0, $external_variable
#   ExternalJob.perform_async
#   assert_equal 1, $external_variable
#
Sidekiq::Testing.inline!