Class: RSpec::Sidekiq::NullBatch

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 = nil) ⇒ NullBatch

Returns a new instance of NullBatch.



15
16
17
18
# File 'lib/rspec/sidekiq/batch.rb', line 15

def initialize(bid = nil)
  @bid = bid || SecureRandom.hex(8)
  @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.



13
14
15
# File 'lib/rspec/sidekiq/batch.rb', line 13

def bid
  @bid
end

Instance Method Details

#jobsObject



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

def jobs(*)
  yield
end

#on(*args) ⇒ Object



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

def on(*args)
  @callbacks << args
end

#statusObject



20
21
22
# File 'lib/rspec/sidekiq/batch.rb', line 20

def status
  NullStatus.new(@bid, @callbacks)
end