1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activejob/test/cases/timezones_test.rb
Andrew White a9d1167b1f 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.
2018-02-22 14:14:42 +00:00

24 lines
589 B
Ruby

# frozen_string_literal: true
require "helper"
require "jobs/timezone_dependent_job"
class TimezonesTest < ActiveSupport::TestCase
setup do
JobBuffer.clear
end
test "it performs the job in the given timezone" do
job = TimezoneDependentJob.new("2018-01-01T00:00:00Z")
job.timezone = "London"
job.perform_now
assert_equal "Happy New Year!", JobBuffer.last_value
job = TimezoneDependentJob.new("2018-01-01T00:00:00Z")
job.timezone = "Eastern Time (US & Canada)"
job.perform_now
assert_equal "Just 5 hours to go", JobBuffer.last_value
end
end