aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2019-03-22 15:52:36 -0400
committerGannon McGibbon <gannon.mcgibbon@gmail.com>2019-03-22 17:04:56 -0400
commit7f038621dfd7eba316b601b010cbf442b63ea17e (patch)
tree6dd343257cb2e2e91981e258c6a91ab297d2f3af /activejob/test/cases
parent4c8a333ac1278ec49cc78097b1c64d00338c01f2 (diff)
downloadrails-7f038621dfd7eba316b601b010cbf442b63ea17e.tar.gz
rails-7f038621dfd7eba316b601b010cbf442b63ea17e.tar.bz2
rails-7f038621dfd7eba316b601b010cbf442b63ea17e.zip
Drop microseconds in job argument assertions
Diffstat (limited to 'activejob/test/cases')
-rw-r--r--activejob/test/cases/test_helper_test.rb54
1 files changed, 54 insertions, 0 deletions
diff --git a/activejob/test/cases/test_helper_test.rb b/activejob/test/cases/test_helper_test.rb
index 4d934df31b..d6607cb6b6 100644
--- a/activejob/test/cases/test_helper_test.rb
+++ b/activejob/test/cases/test_helper_test.rb
@@ -581,6 +581,33 @@ class EnqueuedJobsTest < ActiveJob::TestCase
end
end
+ def test_assert_enqueued_with_time
+ now = Time.now
+ args = [{ argument1: [now] }]
+
+ assert_enqueued_with(job: MultipleKwargsJob, args: args) do
+ MultipleKwargsJob.perform_later(argument1: [now])
+ end
+ end
+
+ def test_assert_enqueued_with_date_time
+ now = DateTime.now
+ args = [{ argument1: [now] }]
+
+ assert_enqueued_with(job: MultipleKwargsJob, args: args) do
+ MultipleKwargsJob.perform_later(argument1: [now])
+ end
+ end
+
+ def test_assert_enqueued_with_time_with_zone
+ now = Time.now.in_time_zone("Tokyo")
+ args = [{ argument1: [now] }]
+
+ assert_enqueued_with(job: MultipleKwargsJob, args: args) do
+ MultipleKwargsJob.perform_later(argument1: [now])
+ end
+ end
+
def test_assert_enqueued_with_with_no_block_args
assert_raise ArgumentError do
NestedJob.set(wait_until: Date.tomorrow.noon).perform_later
@@ -1681,6 +1708,33 @@ class PerformedJobsTest < ActiveJob::TestCase
end
end
+ def test_assert_performed_with_time
+ now = Time.now
+ args = [{ argument1: { now: now } }]
+
+ assert_enqueued_with(job: MultipleKwargsJob, args: args) do
+ MultipleKwargsJob.perform_later(argument1: { now: now })
+ end
+ end
+
+ def test_assert_performed_with_date_time
+ now = DateTime.now
+ args = [{ argument1: { now: now } }]
+
+ assert_enqueued_with(job: MultipleKwargsJob, args: args) do
+ MultipleKwargsJob.perform_later(argument1: { now: now })
+ end
+ end
+
+ def test_assert_performed_with_time_with_zone
+ now = Time.now.in_time_zone("Tokyo")
+ args = [{ argument1: { now: now } }]
+
+ assert_enqueued_with(job: MultipleKwargsJob, args: args) do
+ MultipleKwargsJob.perform_later(argument1: { now: now })
+ end
+ end
+
def test_assert_performed_with_with_global_id_args
ricardo = Person.new(9)
assert_performed_with(job: HelloJob, args: [ricardo]) do