Implement Runner#worker

This commit is contained in:
Thibault Jouan
2015-04-17 21:23:10 +00:00
parent 887c66a6f7
commit fa03cd736a
2 changed files with 39 additions and 0 deletions

View File

@@ -122,6 +122,27 @@ module Uh
end
end
describe '#worker' do
it 'returns a worker' do
expect(runner.worker).to respond_to :work_events
end
it 'setups the read callback to tell manager to handle pending events' do
expect(runner.manager).to receive :handle_pending_events
runner.worker.on_read.call
end
it 'setups the read_next callback to tell manager to handle next event' do
expect(runner.manager).to receive :handle_next_event
runner.worker.on_read_next.call
end
it 'setups the timeout callback to tell manager to flush the output' do
expect(runner.manager).to receive :flush
runner.worker.on_timeout.call
end
end
describe '#run_until' do
it 'tells the manager to handle events until given block is true' do
block = proc { }