aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job/test_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activejob/lib/active_job/test_helper.rb')
-rw-r--r--activejob/lib/active_job/test_helper.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activejob/lib/active_job/test_helper.rb b/activejob/lib/active_job/test_helper.rb
index f03780b91e..e5e2b086bc 100644
--- a/activejob/lib/active_job/test_helper.rb
+++ b/activejob/lib/active_job/test_helper.rb
@@ -631,6 +631,20 @@ module ActiveJob
def prepare_args_for_assertion(args)
args.dup.tap do |arguments|
arguments[:at] = arguments[:at].to_f if arguments[:at]
+ arguments[:args] = round_time_arguments(arguments[:args]) if arguments[:args]
+ end
+ end
+
+ def round_time_arguments(argument)
+ case argument
+ when Time, ActiveSupport::TimeWithZone, DateTime
+ argument.change(usec: 0)
+ when Hash
+ argument.transform_values { |value| round_time_arguments(value) }
+ when Array
+ argument.map { |element| round_time_arguments(element) }
+ else
+ argument
end
end