diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-01-25 22:50:02 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-01-25 22:51:21 -0600 |
commit | a98cd7ca9b2f24a4500963e58ba5c37d6bdf9259 (patch) | |
tree | d9c51d0de740f371c745a859afd043aa6f0b85a0 /actionpack/test/template/render_test.rb | |
parent | 5c062bf1000886d26b3a4c3b08dfb6618a4adcdf (diff) | |
download | rails-a98cd7ca9b2f24a4500963e58ba5c37d6bdf9259.tar.gz rails-a98cd7ca9b2f24a4500963e58ba5c37d6bdf9259.tar.bz2 rails-a98cd7ca9b2f24a4500963e58ba5c37d6bdf9259.zip |
Add localized templates
# Default locale
app/views/messages/index.html.erb
# I18n.locale is set to :da (Danish)
app/views/messages/index.da.html.erb
Diffstat (limited to 'actionpack/test/template/render_test.rb')
-rw-r--r-- | actionpack/test/template/render_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb index 4bd897efeb..c226e212b5 100644 --- a/actionpack/test/template/render_test.rb +++ b/actionpack/test/template/render_test.rb @@ -5,6 +5,13 @@ module RenderTestCases def setup_view(paths) @assigns = { :secret => 'in the sauce' } @view = ActionView::Base.new(paths, @assigns) + + # Reload and register danish language for testing + I18n.reload! + I18n.backend.store_translations 'da', {} + + # Ensure original are still the same since we are reindexing view paths + assert_equal ORIGINAL_LOCALES, I18n.available_locales end def test_render_file @@ -19,6 +26,14 @@ module RenderTestCases assert_equal "Hello world!", @view.render(:file => "test/hello_world") end + def test_render_file_with_localization + old_locale = I18n.locale + I18n.locale = :da + assert_equal "Hey verden", @view.render(:file => "test/hello_world") + ensure + I18n.locale = old_locale + end + def test_render_file_at_top_level assert_equal 'Elastica', @view.render(:file => '/shared') end |