fixes run order in Rails::Queueing::TestQueue
This commit is contained in:
parent
cd50b60431
commit
9d630d4368
@ -18,7 +18,7 @@ def drain
|
||||
# run the jobs in a separate thread so assumptions of synchronous
|
||||
# jobs are caught in test mode.
|
||||
t = Thread.new do
|
||||
while job = @contents.pop
|
||||
while job = @contents.shift
|
||||
job.run
|
||||
end
|
||||
end
|
||||
|
@ -25,6 +25,19 @@ def test_contents
|
||||
assert_equal [job], @queue.contents
|
||||
end
|
||||
|
||||
def test_order
|
||||
time1 = time2 = nil
|
||||
|
||||
job1 = Job.new(1) { time1 = Time.now }
|
||||
job2 = Job.new(2) { time2 = Time.now }
|
||||
|
||||
@queue.push job1
|
||||
@queue.push job2
|
||||
@queue.drain
|
||||
|
||||
assert time1 < time2, "Jobs run in the same order they were added"
|
||||
end
|
||||
|
||||
def test_drain
|
||||
t = nil
|
||||
ran = false
|
||||
|
Loading…
Reference in New Issue
Block a user