class RSpec::Sidekiq::NullStatus

Attributes

bid[R]

Public Class Methods

new(bid = SecureRandom.hex(8), callbacks = []) click to toggle source
# File lib/rspec/sidekiq/batch.rb, line 55
def initialize(bid = SecureRandom.hex(8), callbacks = [])
  @bid = bid
  @callbacks = callbacks
end

Public Instance Methods

failures() click to toggle source
# File lib/rspec/sidekiq/batch.rb, line 60
def failures
  0
end
join() click to toggle source
# File lib/rspec/sidekiq/batch.rb, line 64
def join
  ::Sidekiq::Worker.drain_all

  @callbacks.each do |event, callback, options|
    if event != :success || failures == 0
      case callback
      when Class
        callback.new.send("on_#{event}", self, options)
      when String
        klass, meth = callback.split('#')
        klass.constantize.new.send(meth, self, options)
      else
        raise ArgumentError, 'Unsupported callback notation'
      end
    end
  end
end
total() click to toggle source
# File lib/rspec/sidekiq/batch.rb, line 82
def total
  ::Sidekiq::Worker.jobs.size
end