aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/mime_responds_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/mime_responds_test.rb')
-rw-r--r--actionpack/test/controller/mime_responds_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index c3763bc566..d18d4679d4 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -61,6 +61,17 @@ class RespondToController < ActionController::Base
type.all { render :text => "Nothing" }
end
end
+
+ def custom_constant_handling
+ Mime::Type.register("text/x-mobile", :mobile)
+
+ respond_to do |type|
+ type.html { render :text => "HTML" }
+ type.mobile { render :text => "Mobile" }
+ end
+
+ Mime.send :remove_const, :MOBILE
+ end
def handle_any
respond_to do |type|
@@ -255,6 +266,11 @@ class MimeControllerTest < Test::Unit::TestCase
assert_equal '$("body").visualEffect("highlight");', @response.body
end
+ def test_custom_constant
+ get :custom_constant_handling, :format => "mobile"
+ assert_equal "Mobile", @response.body
+ end
+
def test_forced_format
get :html_xml_or_rss
assert_equal "HTML", @response.body