diff options
author | Andrew White <andrew.white@unboxed.co> | 2018-02-22 14:14:42 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2018-02-22 14:14:42 +0000 |
commit | a9d1167b1fdae6f5f5496738b3e7d1e05949dcd0 (patch) | |
tree | 8a46f129aaed18c7c48b35aa0e48f9a19c1bc219 /activejob/test/support | |
parent | 9c0c90979a759a41628e0cd9d73821b0b34d03fc (diff) | |
download | rails-a9d1167b1fdae6f5f5496738b3e7d1e05949dcd0.tar.gz rails-a9d1167b1fdae6f5f5496738b3e7d1e05949dcd0.tar.bz2 rails-a9d1167b1fdae6f5f5496738b3e7d1e05949dcd0.zip |
Add support for timezones to Active Job
Record what was the current timezone in effect when the job was
enqueued and then restore when the job is executed in same way
that the current locale is recorded and restored.
Diffstat (limited to 'activejob/test/support')
-rw-r--r-- | activejob/test/support/integration/dummy_app_template.rb | 1 | ||||
-rw-r--r-- | activejob/test/support/integration/test_case_helpers.rb | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/activejob/test/support/integration/dummy_app_template.rb b/activejob/test/support/integration/dummy_app_template.rb index 7ea78c3350..b56dd3e591 100644 --- a/activejob/test/support/integration/dummy_app_template.rb +++ b/activejob/test/support/integration/dummy_app_template.rb @@ -21,6 +21,7 @@ class TestJob < ActiveJob::Base File.open(Rails.root.join("tmp/\#{x}.new"), "wb+") do |f| f.write Marshal.dump({ "locale" => I18n.locale.to_s || "en", + "timezone" => Time.zone.try(:name) || "UTC", "executed_at" => Time.now.to_r }) end diff --git a/activejob/test/support/integration/test_case_helpers.rb b/activejob/test/support/integration/test_case_helpers.rb index f02a32a38e..3d9b265b66 100644 --- a/activejob/test/support/integration/test_case_helpers.rb +++ b/activejob/test/support/integration/test_case_helpers.rb @@ -62,4 +62,8 @@ module TestCaseHelpers def job_executed_in_locale(id = @id) job_data(id)["locale"] end + + def job_executed_in_timezone(id = @id) + job_data(id)["timezone"] + end end |