aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases/timezones_test.rb
blob: e2095b020d4a8568efd5dc7961721a3fe79e9190 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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