mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
In development and test we drain the jobs in the same thread.
This commit is contained in:
parent
aebbd4bb4d
commit
fb0c845e92
1 changed files with 4 additions and 4 deletions
|
@ -47,7 +47,7 @@ module ApplicationTests
|
|||
end
|
||||
end
|
||||
|
||||
test "in development mode, an enqueued job will be processed in a separate thread" do
|
||||
test "in development mode, an enqueued job will be processed in the same thread" do
|
||||
app("development")
|
||||
|
||||
job = ThreadTrackingJob.new
|
||||
|
@ -55,10 +55,10 @@ module ApplicationTests
|
|||
sleep 0.1
|
||||
|
||||
assert job.ran?, "Expected job to be run"
|
||||
assert job.ran_in_different_thread?, "Expected job to run in the same thread"
|
||||
refute job.ran_in_different_thread?, "Expected job to run in the same thread"
|
||||
end
|
||||
|
||||
test "in test mode, explicitly draining the queue will process it in a separate thread" do
|
||||
test "in test mode, explicitly draining the queue will process it in the same thread" do
|
||||
app("test")
|
||||
|
||||
Rails.queue.push ThreadTrackingJob.new
|
||||
|
@ -66,7 +66,7 @@ module ApplicationTests
|
|||
Rails.queue.drain
|
||||
|
||||
assert job.ran?, "Expected job to be run"
|
||||
assert job.ran_in_different_thread?, "Expected job to run in a different thread"
|
||||
refute job.ran_in_different_thread?, "Expected job to run in the same thread"
|
||||
end
|
||||
|
||||
class IdentifiableJob
|
||||
|
|
Loading…
Reference in a new issue