diff options
author | Tobias Lütke <tobias.luetke@gmail.com> | 2006-08-30 00:34:36 +0000 |
---|---|---|
committer | Tobias Lütke <tobias.luetke@gmail.com> | 2006-08-30 00:34:36 +0000 |
commit | ff063d700d2fda2076217ab0479e8602253ab49c (patch) | |
tree | f702ff587de6e648cf6746da7d01fa959efd37ae /actionpack/test/controller/mime_responds_test.rb | |
parent | 3704088ebde5ef074d186bff0d380858a9a01055 (diff) | |
download | rails-ff063d700d2fda2076217ab0479e8602253ab49c.tar.gz rails-ff063d700d2fda2076217ab0479e8602253ab49c.tar.bz2 rails-ff063d700d2fda2076217ab0479e8602253ab49c.zip |
respond_to .html now always renders #{action_name}.rhtml so that registered custom template handlers do not override it in priority.
Custom mime types require a block and throw proper error now.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4860 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/mime_responds_test.rb')
-rw-r--r-- | actionpack/test/controller/mime_responds_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb index d18d4679d4..9118d9e553 100644 --- a/actionpack/test/controller/mime_responds_test.rb +++ b/actionpack/test/controller/mime_responds_test.rb @@ -72,6 +72,18 @@ class RespondToController < ActionController::Base Mime.send :remove_const, :MOBILE end + + def custom_constant_handling_without_block + Mime::Type.register("text/x-mobile", :mobile) + + respond_to do |type| + type.html { render :text => "HTML" } + type.mobile + end + + Mime.send :remove_const, :MOBILE + end + def handle_any respond_to do |type| @@ -271,6 +283,13 @@ class MimeControllerTest < Test::Unit::TestCase assert_equal "Mobile", @response.body end + def custom_constant_handling_without_block + + assert_raised(ActionController::RenderError) do + get :custom_constant_handling, :format => "mobile" + end + end + def test_forced_format get :html_xml_or_rss assert_equal "HTML", @response.body |