diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-03-28 20:21:52 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-03-28 20:21:52 +0000 |
commit | 6efee90bf234328e3672bc79408c2da5b9673539 (patch) | |
tree | 1cea5008db0ae0870511647e7ebbf9ec4685bd5d /actionpack/test | |
parent | 6b5fe9c644397ab0c3b1a1a889b3677b8f69184d (diff) | |
download | rails-6efee90bf234328e3672bc79408c2da5b9673539.tar.gz rails-6efee90bf234328e3672bc79408c2da5b9673539.tar.bz2 rails-6efee90bf234328e3672bc79408c2da5b9673539.zip |
Missing :js template falls back to :html, so you don't have to explicitly specify template format everywhere, breaking old code
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9119 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/template_object_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/actionpack/test/template/template_object_test.rb b/actionpack/test/template/template_object_test.rb index 780df17f0c..b3a33938cf 100644 --- a/actionpack/test/template/template_object_test.rb +++ b/actionpack/test/template/template_object_test.rb @@ -59,4 +59,32 @@ class TemplateObjectTest < Test::Unit::TestCase end end + class PartialTemplateFallbackTest < Test::Unit::TestCase + def setup + @view = ActionView::Base.new(LOAD_PATH_ROOT) + @path = 'test/layout_for_partial' + end + + def test_default + template = ActionView::PartialTemplate.new(@view, @path, nil) + assert_equal 'test/_layout_for_partial', template.path + assert_equal 'erb', template.extension + assert_equal :html, @view.template_format + end + + def test_js + @view.template_format = :js + template = ActionView::PartialTemplate.new(@view, @path, nil) + assert_equal 'test/_layout_for_partial', template.path + assert_equal 'erb', template.extension + assert_equal :html, @view.template_format + end + + def test_xml + @view.template_format = :xml + assert_raise ActionView::ActionViewError do + ActionView::PartialTemplate.new(@view, @path, nil) + end + end + end end |