Class: RSpec::Sidekiq::NullStatus

Inherits:
NullObject show all
Defined in:
lib/rspec/sidekiq/batch.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from NullObject

#method_missing

Constructor Details

#initialize(bid, callbacks) ⇒ NullStatus

Returns a new instance of NullStatus.



36
37
38
39
# File 'lib/rspec/sidekiq/batch.rb', line 36

def initialize(bid, callbacks)
  @bid = bid
  @callbacks = callbacks
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RSpec::Sidekiq::NullObject

Instance Attribute Details

#bidObject (readonly)

Returns the value of attribute bid.



34
35
36
# File 'lib/rspec/sidekiq/batch.rb', line 34

def bid
  @bid
end

Instance Method Details

#failuresObject



41
42
43
# File 'lib/rspec/sidekiq/batch.rb', line 41

def failures
  0
end

#joinObject



45
46
47
48
49
50
51
52
53
# File 'lib/rspec/sidekiq/batch.rb', line 45

def join
  ::Sidekiq::Worker.drain_all

  @callbacks.each do |event, callback_class, options|
    if event != :success || failures == 0
      callback_class.new.send("on_#{event}", self, options)
    end
  end
end

#totalObject



55
56
57
# File 'lib/rspec/sidekiq/batch.rb', line 55

def total
  ::Sidekiq::Worker.jobs.size
end