diff options
Diffstat (limited to 'activejob/test')
-rw-r--r-- | activejob/test/cases/test_helper_test.rb | 22 | ||||
-rw-r--r-- | activejob/test/integration/queuing_test.rb | 2 | ||||
-rw-r--r-- | activejob/test/support/integration/adapters/que.rb | 2 | ||||
-rw-r--r-- | activejob/test/support/que/inline.rb | 6 |
4 files changed, 29 insertions, 3 deletions
diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb index 19a2820a6e..04c4c446e2 100644 --- a/activejob/test/cases/test_helper_test.rb +++ b/activejob/test/cases/test_helper_test.rb @@ -31,6 +31,17 @@ class EnqueuedJobsTest < ActiveJob::TestCase end end + def test_assert_enqueued_jobs_message + HelloJob.perform_later('sean') + e = assert_raises Minitest::Assertion do + assert_enqueued_jobs 2 do + HelloJob.perform_later('sean') + end + end + assert_match "Expected: 2", e.message + assert_match "Actual: 1", e.message + end + def test_assert_enqueued_jobs_with_no_block assert_nothing_raised do HelloJob.perform_later('rafael') @@ -230,6 +241,17 @@ class PerformedJobsTest < ActiveJob::TestCase end end + def test_assert_performed_jobs_message + HelloJob.perform_later('sean') + e = assert_raises Minitest::Assertion do + assert_performed_jobs 2 do + HelloJob.perform_later('sean') + end + end + assert_match "Expected: 2", e.message + assert_match "Actual: 1", e.message + end + def test_assert_performed_jobs_with_no_block assert_nothing_raised do perform_enqueued_jobs do diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb index 09f5c329cc..96794ffef3 100644 --- a/activejob/test/integration/queuing_test.rb +++ b/activejob/test/integration/queuing_test.rb @@ -11,7 +11,7 @@ class QueuingTest < ActiveSupport::TestCase end test 'should not run jobs queued on a non-listening queue' do - skip if adapter_is?(:inline) || adapter_is?(:sucker_punch) + skip if adapter_is?(:inline) || adapter_is?(:sucker_punch) || adapter_is?(:que) old_queue = TestJob.queue_name begin diff --git a/activejob/test/support/integration/adapters/que.rb b/activejob/test/support/integration/adapters/que.rb index ff5235bdc8..0cd8952a28 100644 --- a/activejob/test/support/integration/adapters/que.rb +++ b/activejob/test/support/integration/adapters/que.rb @@ -23,7 +23,7 @@ module QueJobsManager @thread = Thread.new do loop do - Que::Job.work("integration_tests") + Que::Job.work sleep 0.5 end end diff --git a/activejob/test/support/que/inline.rb b/activejob/test/support/que/inline.rb index 2e210acb6b..0232da1370 100644 --- a/activejob/test/support/que/inline.rb +++ b/activejob/test/support/que/inline.rb @@ -3,7 +3,11 @@ require 'que' Que::Job.class_eval do class << self; alias_method :original_enqueue, :enqueue; end def self.enqueue(*args) - args.pop if args.last.is_a?(Hash) + if args.last.is_a?(Hash) + options = args.pop + options.delete(:run_at) + args << options unless options.empty? + end self.run(*args) end end |