test/worker_test.rb in rocketjob-1.0.0 vs test/worker_test.rb in rocketjob-1.1.0
- old
+ new
@@ -5,14 +5,15 @@
class WorkerTest < Minitest::Test
context RocketJob::Worker do
setup do
RocketJob::Config.instance.heartbeat_seconds = 0.1
RocketJob::Config.instance.max_poll_seconds = 0.1
- @worker = RocketJob::Worker.new
+
+ @worker = RocketJob::Worker.new
@description = 'Hello World'
- @arguments = [ 1 ]
- @job = Jobs::TestJob.new(
+ @arguments = [1]
+ @job = Jobs::TestJob.new(
description: @description,
arguments: @arguments,
destroy_on_complete: false
)
end
@@ -27,10 +28,13 @@
end
end
context '#run' do
should 'run a worker' do
- Thread.new { sleep 1; @worker.stop!}
+ Thread.new do
+ sleep 1
+ @worker.stop!
+ end
@worker.run
assert_equal :stopping, @worker.state, @worker.inspect
end
end