From 7f038621dfd7eba316b601b010cbf442b63ea17e Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Fri, 22 Mar 2019 15:52:36 -0400 Subject: Drop microseconds in job argument assertions --- activejob/test/cases/test_helper_test.rb | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'activejob/test') 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 -- cgit v1.2.3