aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/integration
diff options
context:
space:
mode:
authorwvengen <dev-rails@willem.engen.nl>2015-03-18 10:48:26 +0100
committerwvengen <dev-rails@willem.engen.nl>2015-09-17 22:17:39 +0200
commit7059ab35f797c163cd8907abcd7d0830b31e56f7 (patch)
tree708ccbf2da4412030b305f79c629a6961eb487c1 /activejob/test/integration
parent61f9e47feac75a2cf4ed9e092bac036294564168 (diff)
downloadrails-7059ab35f797c163cd8907abcd7d0830b31e56f7.tar.gz
rails-7059ab35f797c163cd8907abcd7d0830b31e56f7.tar.bz2
rails-7059ab35f797c163cd8907abcd7d0830b31e56f7.zip
Add job priorities to ActiveJob
Diffstat (limited to 'activejob/test/integration')
-rw-r--r--activejob/test/integration/queuing_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb
index 125ba54302..e435ed4aa6 100644
--- a/activejob/test/integration/queuing_test.rb
+++ b/activejob/test/integration/queuing_test.rb
@@ -84,4 +84,16 @@ class QueuingTest < ActiveSupport::TestCase
I18n.locale = :en
end
end
+
+ test 'should run job with higher priority first' do
+ skip unless adapter_is?(:delayed_job, :que)
+
+ wait_until = Time.now + 3.seconds
+ TestJob.set(wait_until: wait_until, priority: 20).perform_later "#{@id}.1"
+ TestJob.set(wait_until: wait_until, priority: 10).perform_later "#{@id}.2"
+ wait_for_jobs_to_finish_for(10.seconds)
+ assert job_executed "#{@id}.1"
+ assert job_executed "#{@id}.2"
+ assert job_executed_at("#{@id}.2") < job_executed_at("#{@id}.1")
+ end
end