aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib/active_job
diff options
context:
space:
mode:
Diffstat (limited to 'activejob/lib/active_job')
-rw-r--r--activejob/lib/active_job/core.rb4
-rw-r--r--activejob/lib/active_job/test_helper.rb3
2 files changed, 4 insertions, 3 deletions
diff --git a/activejob/lib/active_job/core.rb b/activejob/lib/active_job/core.rb
index 283125698d..5b10858d80 100644
--- a/activejob/lib/active_job/core.rb
+++ b/activejob/lib/active_job/core.rb
@@ -100,7 +100,7 @@ module ActiveJob
"executions" => executions,
"exception_executions" => exception_executions,
"locale" => I18n.locale.to_s,
- "timezone" => Time.zone.try(:name),
+ "timezone" => Time.zone&.name,
"enqueued_at" => Time.now.utc.iso8601
}
end
@@ -140,7 +140,7 @@ module ActiveJob
self.executions = job_data["executions"]
self.exception_executions = job_data["exception_executions"]
self.locale = job_data["locale"] || I18n.locale.to_s
- self.timezone = job_data["timezone"] || Time.zone.try(:name)
+ self.timezone = job_data["timezone"] || Time.zone&.name
self.enqueued_at = job_data["enqueued_at"]
end
diff --git a/activejob/lib/active_job/test_helper.rb b/activejob/lib/active_job/test_helper.rb
index 463020a332..5b1af7da22 100644
--- a/activejob/lib/active_job/test_helper.rb
+++ b/activejob/lib/active_job/test_helper.rb
@@ -630,7 +630,7 @@ module ActiveJob
def prepare_args_for_assertion(args)
args.dup.tap do |arguments|
- arguments[:at] = arguments[:at].to_f if arguments[:at]
+ arguments[:at] = round_time_arguments(arguments[:at]) if arguments[:at]
arguments[:args] = round_time_arguments(arguments[:args]) if arguments[:args]
end
end
@@ -650,6 +650,7 @@ module ActiveJob
def deserialize_args_for_assertion(job)
job.dup.tap do |new_job|
+ new_job[:at] = round_time_arguments(Time.at(new_job[:at])) if new_job[:at]
new_job[:args] = ActiveJob::Arguments.deserialize(new_job[:args]) if new_job[:args]
end
end