aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases/translation_test.rb
blob: 6a0d6d3e546d5d8c837bb93ea8640cb6d52808eb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require "helper"
require "jobs/translated_hello_job"

class TranslationTest < ActiveSupport::TestCase
  setup do
    JobBuffer.clear
    I18n.available_locales = [:en, :de]
    @job = TranslatedHelloJob.new("Johannes")
  end

  teardown do
    I18n.available_locales = [:en]
  end

  test "it performs the job in the given locale" do
    @job.locale = :de
    @job.perform_now
    assert_equal "Johannes says Guten Tag", JobBuffer.last_value
  end
end