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/integration | |
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/integration')
-rw-r--r-- | activejob/test/integration/queuing_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activejob/test/integration/queuing_test.rb b/activejob/test/integration/queuing_test.rb index 32ef485c45..7a95d3d039 100644 --- a/activejob/test/integration/queuing_test.rb +++ b/activejob/test/integration/queuing_test.rb @@ -110,6 +110,22 @@ class QueuingTest < ActiveSupport::TestCase end end + test "current timezone is kept while running perform_later" do + skip if adapter_is?(:inline) + + begin + current_zone = Time.zone + Time.zone = "Hawaii" + + TestJob.perform_later @id + wait_for_jobs_to_finish_for(5.seconds) + assert job_executed + assert_equal "Hawaii", job_executed_in_timezone + ensure + Time.zone = current_zone + end + end + test "should run job with higher priority first" do skip unless adapter_is?(:delayed_job, :que) |