diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2006-06-02 04:38:28 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2006-06-02 04:38:28 +0000 |
commit | 6dea52c54e272b4592d1d157c8626003b03fcac1 (patch) | |
tree | 0e9444eee56c4ced2bb1ec08afb737bc50ee1ce3 /actionpack/test/controller/mime_responds_test.rb | |
parent | 180edf4146fcfabd2e0573e451adcfa9e781bd63 (diff) | |
download | rails-6dea52c54e272b4592d1d157c8626003b03fcac1.tar.gz rails-6dea52c54e272b4592d1d157c8626003b03fcac1.tar.bz2 rails-6dea52c54e272b4592d1d157c8626003b03fcac1.zip |
Finish custom handling [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4409 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 | 16 |
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 |