aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/queueing
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-04-27 13:49:45 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-04-27 13:49:45 -0700
commit3ca7b137fbc7001a9b3384d2a44132913a93bb4b (patch)
tree9dc5814567b6053f19276541e668a22b5ab1240b /railties/test/queueing
parent4dcaffb04c8e35493b257f532ed3a5e0378d606f (diff)
parent804db94471b7f7d222fd7371de7443df86bfb7c8 (diff)
downloadrails-3ca7b137fbc7001a9b3384d2a44132913a93bb4b.tar.gz
rails-3ca7b137fbc7001a9b3384d2a44132913a93bb4b.tar.bz2
rails-3ca7b137fbc7001a9b3384d2a44132913a93bb4b.zip
Merge pull request #6020 from 7even/test_queue_order
Rails::Queueing::TestQueue run order
Diffstat (limited to 'railties/test/queueing')
-rw-r--r--railties/test/queueing/test_queue_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/railties/test/queueing/test_queue_test.rb b/railties/test/queueing/test_queue_test.rb
index de30e8cffd..3dfe586110 100644
--- a/railties/test/queueing/test_queue_test.rb
+++ b/railties/test/queueing/test_queue_test.rb
@@ -25,6 +25,19 @@ class TestQueueTest < ActiveSupport::TestCase
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