aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/localized_templates_test.rb
blob: bac1d0297776cb0b1dc8b21d5b248d14a55e729f (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
25
26
27
28
require 'abstract_unit'

class LocalizedController < ActionController::Base
  def hello_world
  end
end

class LocalizedTemplatesTest < ActionController::TestCase
  tests LocalizedController

  def test_localized_template_is_used
    old_locale = I18n.locale
    I18n.locale = :de
    get :hello_world
    assert_equal "Gutten Tag", @response.body
  ensure
    I18n.locale = old_locale
  end

  def test_default_locale_template_is_used_when_locale_is_missing
    old_locale = I18n.locale
    I18n.locale = :dk
    get :hello_world
    assert_equal "Hello World", @response.body
  ensure
    I18n.locale = old_locale
  end
end