From ff063d700d2fda2076217ab0479e8602253ab49c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20L=C3=BCtke?= Date: Wed, 30 Aug 2006 00:34:36 +0000 Subject: 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 --- actionpack/test/controller/mime_responds_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'actionpack/test') 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 -- cgit v1.2.3