aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases/test_helper_test.rb
diff options
context:
space:
mode:
authorRichard Manyanza <rm@dsc.co.tz>2015-01-23 14:01:25 +0300
committerRichard Manyanza <rm@dsc.co.tz>2015-01-23 17:46:16 +0300
commit9d3042d05e69cecbba25036289eb6ac39fb182fc (patch)
tree01663a39f1b9f65e574a1121cb384223e624d232 /activejob/test/cases/test_helper_test.rb
parent139c232b075da940cdf1042dcaad4c3b514908c9 (diff)
downloadrails-9d3042d05e69cecbba25036289eb6ac39fb182fc.tar.gz
rails-9d3042d05e69cecbba25036289eb6ac39fb182fc.tar.bz2
rails-9d3042d05e69cecbba25036289eb6ac39fb182fc.zip
Fix ActiveJob assertions with a GlobalID object argument
Diffstat (limited to 'activejob/test/cases/test_helper_test.rb')
-rw-r--r--activejob/test/cases/test_helper_test.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb
index f34638e7d8..0a23ae33c4 100644
--- a/activejob/test/cases/test_helper_test.rb
+++ b/activejob/test/cases/test_helper_test.rb
@@ -4,6 +4,7 @@ require 'active_support/core_ext/date'
require 'jobs/hello_job'
require 'jobs/logging_job'
require 'jobs/nested_job'
+require 'models/person'
class EnqueuedJobsTest < ActiveJob::TestCase
def test_assert_enqueued_jobs
@@ -175,6 +176,25 @@ class EnqueuedJobsTest < ActiveJob::TestCase
end
end
end
+
+ def test_assert_enqueued_job_with_global_id_args
+ ricardo = Person.new(9)
+ assert_enqueued_with(job: HelloJob, args: [ricardo]) do
+ HelloJob.perform_later(ricardo)
+ end
+ end
+
+ def test_assert_enqueued_job_failure_with_global_id_args
+ ricardo = Person.new(9)
+ wilma = Person.new(11)
+ error = assert_raise ActiveSupport::TestCase::Assertion do
+ assert_enqueued_with(job: HelloJob, args: [wilma]) do
+ HelloJob.perform_later(ricardo)
+ end
+ end
+
+ assert_equal "No enqueued job found with {:job=>HelloJob, :args=>[#{wilma.inspect}]}", error.message
+ end
end
class PerformedJobsTest < ActiveJob::TestCase
@@ -282,4 +302,23 @@ class PerformedJobsTest < ActiveJob::TestCase
end
end
end
+
+ def test_assert_performed_job_with_global_id_args
+ ricardo = Person.new(9)
+ assert_performed_with(job: HelloJob, args: [ricardo]) do
+ HelloJob.perform_later(ricardo)
+ end
+ end
+
+ def test_assert_performed_job_failure_with_global_id_args
+ ricardo = Person.new(9)
+ wilma = Person.new(11)
+ error = assert_raise ActiveSupport::TestCase::Assertion do
+ assert_performed_with(job: HelloJob, args: [wilma]) do
+ HelloJob.perform_later(ricardo)
+ end
+ end
+
+ assert_equal "No performed job found with {:job=>HelloJob, :args=>[#{wilma.inspect}]}", error.message
+ end
end