diff options
author | John Hawthorn <john@hawthorn.email> | 2019-04-12 16:08:30 -0700 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2019-04-12 16:08:30 -0700 |
commit | 2455d16a5a975fa5bf75bdb023df61047b055e3d (patch) | |
tree | 141cbbd24e8b389508cd62b172e1484757f16f32 /actionview | |
parent | 0b26cc41dbd8c57eb382318a63c4272de3d2e4e9 (diff) | |
download | rails-2455d16a5a975fa5bf75bdb023df61047b055e3d.tar.gz rails-2455d16a5a975fa5bf75bdb023df61047b055e3d.tar.bz2 rails-2455d16a5a975fa5bf75bdb023df61047b055e3d.zip |
Add additional test for sharing templates
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/test/template/resolver_shared_tests.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/actionview/test/template/resolver_shared_tests.rb b/actionview/test/template/resolver_shared_tests.rb index ee73ec1922..525b452075 100644 --- a/actionview/test/template/resolver_shared_tests.rb +++ b/actionview/test/template/resolver_shared_tests.rb @@ -110,13 +110,30 @@ module ResolverSharedTests end def test_same_template_from_different_details_is_same_object - with_file "test/hello_world.html.erb", "Hello plain text!" + with_file "test/hello_world.html.erb", "Hello HTML!" a = context.find("hello_world", "test", false, [], locale: [:en]) b = context.find("hello_world", "test", false, [], locale: [:fr]) assert_same a, b end + def test_templates_with_optional_locale_shares_common_object + with_file "test/hello_world.text.erb", "Generic plain text!" + with_file "test/hello_world.fr.text.erb", "Texte en Francais!" + + en = context.find_all("hello_world", "test", false, [], locale: [:en]) + fr = context.find_all("hello_world", "test", false, [], locale: [:fr]) + + assert_equal 1, en.size + assert_equal 2, fr.size + + assert_equal "Generic plain text!", en[0].source + assert_equal "Texte en Francais!", fr[0].source + assert_equal "Generic plain text!", fr[1].source + + assert_same en[0], fr[1] + end + def test_virtual_path_is_preserved_with_dot with_file "test/hello_world.html.erb", "Hello html!" |