Class: Sidekiq::Testing

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq/testing.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.__test_modeObject

Returns the value of attribute __test_mode.



8
9
10
# File 'lib/sidekiq/testing.rb', line 8

def __test_mode
  @__test_mode
end

Class Method Details

.__set_test_mode(mode, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sidekiq/testing.rb', line 10

def __set_test_mode(mode, &block)
  if block
    current_mode = self.__test_mode
    begin
      self.__test_mode = mode
      block.call
    ensure
      self.__test_mode = current_mode
    end
  else
    self.__test_mode = mode
  end
end

.disable!(&block) ⇒ Object



24
25
26
# File 'lib/sidekiq/testing.rb', line 24

def disable!(&block)
  __set_test_mode(:disable, &block)
end

.disabled?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/sidekiq/testing.rb', line 40

def disabled?
  self.__test_mode == :disable
end

.enabled?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/sidekiq/testing.rb', line 36

def enabled?
  self.__test_mode != :disable
end

.fake!(&block) ⇒ Object



28
29
30
# File 'lib/sidekiq/testing.rb', line 28

def fake!(&block)
  __set_test_mode(:fake, &block)
end

.fake?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/sidekiq/testing.rb', line 44

def fake?
  self.__test_mode == :fake
end

.inline!(&block) ⇒ Object



32
33
34
# File 'lib/sidekiq/testing.rb', line 32

def inline!(&block)
  __set_test_mode(:inline, &block)
end

.inline?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/sidekiq/testing.rb', line 48

def inline?
  self.__test_mode == :inline
end