Skip to content

Commit

Permalink
Merge pull request sidekiq#1416 from tmaier/1415-i18n-test
Browse files Browse the repository at this point in the history
Add I18n test for sidekiq#1415
  • Loading branch information
mperham committed Jan 1, 2014
2 parents 4116e25 + 37a576a commit e9b2bae
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/test_middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,27 @@ def call(*args)
assert_equal :fr, msg['locale']

msg['locale'] = 'jp'
I18n.locale = nil
I18n.locale = I18n.default_locale
assert_equal :en, I18n.locale
mw = Sidekiq::Middleware::I18n::Server.new
mw.call(nil, msg, nil) do
assert_equal :jp, I18n.locale
end
assert_equal :en, I18n.locale
end

it 'supports I18n.enforce_available_locales = true' do
I18n.enforce_available_locales = true
I18n.available_locales = [:en, :jp]

msg = { 'locale' => 'jp' }
mw = Sidekiq::Middleware::I18n::Server.new
mw.call(nil, msg, nil) do
assert_equal :jp, I18n.locale
end

I18n.enforce_available_locales = nil
I18n.available_locales = nil
end
end
end

0 comments on commit e9b2bae

Please sign in to comment.