2017-07-09 13:49:52 -04:00
|
|
|
# frozen_string_literal: true
|
2017-07-10 09:40:03 -04:00
|
|
|
|
2016-08-06 12:41:18 -04:00
|
|
|
require "helper"
|
|
|
|
require "jobs/translated_hello_job"
|
2015-07-07 15:52:28 -04:00
|
|
|
|
|
|
|
class TranslationTest < ActiveSupport::TestCase
|
|
|
|
setup do
|
|
|
|
JobBuffer.clear
|
|
|
|
I18n.available_locales = [:en, :de]
|
2016-08-06 12:41:18 -04:00
|
|
|
@job = TranslatedHelloJob.new("Johannes")
|
2015-07-07 15:52:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
teardown do
|
|
|
|
I18n.available_locales = [:en]
|
|
|
|
end
|
|
|
|
|
2016-08-06 12:41:18 -04:00
|
|
|
test "it performs the job in the given locale" do
|
2015-07-07 15:52:28 -04:00
|
|
|
@job.locale = :de
|
|
|
|
@job.perform_now
|
|
|
|
assert_equal "Johannes says Guten Tag", JobBuffer.last_value
|
|
|
|
end
|
|
|
|
end
|