Module: RSpec::EM::AsyncSteps::Scheduler

Defined in:
lib/rspec/eventmachine/async_steps.rb

Instance Method Summary collapse

Instance Method Details

#__end_steps__Object



45
46
47
48
# File 'lib/rspec/eventmachine/async_steps.rb', line 45

def __end_steps__
  @__step_queue__ = []
  __run_next_step__
end

#__enqueue__(args) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/rspec/eventmachine/async_steps.rb', line 24

def __enqueue__(args)
  @__step_queue__ ||= []
  @__step_queue__ << args
  return if @__running_steps__
  @__running_steps__ = true
  EventMachine.next_tick { __run_next_step__ }
end

#__run_next_step__Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rspec/eventmachine/async_steps.rb', line 32

def __run_next_step__
  step = @__step_queue__.shift
  return EventMachine.stop unless step
  
  method_name, args = step.shift, step
  begin
    method(method_name).call(*args) { __run_next_step__ }
  rescue Object
    __end_steps__
    raise
  end
end

#teardown_mocks_for_rspecObject



54
55
56
# File 'lib/rspec/eventmachine/async_steps.rb', line 54

def teardown_mocks_for_rspec
  EventMachine.reactor_running? ? false : super
end

#verify_mocks_for_rspecObject



50
51
52
# File 'lib/rspec/eventmachine/async_steps.rb', line 50

def verify_mocks_for_rspec
  EventMachine.reactor_running? ? false : super
end