aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2008-03-07 11:17:05 +0000
committerPratik Naik <pratiknaik@gmail.com>2008-03-07 11:17:05 +0000
commit011e4694107f294e2b57cd885f9917205fccdcff (patch)
treedbefbd42d08f6ae1c9c732423bd30125e2a4e241 /actionpack/test/controller
parent867063134fb903046d9eac27755a67204a26e148 (diff)
downloadrails-011e4694107f294e2b57cd885f9917205fccdcff.tar.gz
rails-011e4694107f294e2b57cd885f9917205fccdcff.tar.bz2
rails-011e4694107f294e2b57cd885f9917205fccdcff.zip
Make MimeResponds::Responder#any work without explicit types. Closes #11140 [jaw6]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8987 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/mime_responds_test.rb36
1 files changed, 36 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index febdbd0993..c34643ddd5 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -107,6 +107,13 @@ class RespondToController < ActionController::Base
type.any(:js, :xml) { render :text => "Either JS or XML" }
end
end
+
+ def handle_any_any
+ respond_to do |type|
+ type.html { render :text => 'HTML' }
+ type.any { render :text => 'Whatever you ask for, I got it' }
+ end
+ end
def all_types_with_layout
respond_to do |type|
@@ -335,6 +342,35 @@ class MimeControllerTest < Test::Unit::TestCase
assert_equal 'Either JS or XML', @response.body
end
+ def test_handle_any_any
+ @request.env["HTTP_ACCEPT"] = "*/*"
+ get :handle_any_any
+ assert_equal 'HTML', @response.body
+ end
+
+ def test_handle_any_any_parameter_format
+ get :handle_any_any, {:format=>'html'}
+ assert_equal 'HTML', @response.body
+ end
+
+ def test_handle_any_any_explicit_html
+ @request.env["HTTP_ACCEPT"] = "text/html"
+ get :handle_any_any
+ assert_equal 'HTML', @response.body
+ end
+
+ def test_handle_any_any_javascript
+ @request.env["HTTP_ACCEPT"] = "text/javascript"
+ get :handle_any_any
+ assert_equal 'Whatever you ask for, I got it', @response.body
+ end
+
+ def test_handle_any_any_xml
+ @request.env["HTTP_ACCEPT"] = "text/xml"
+ get :handle_any_any
+ assert_equal 'Whatever you ask for, I got it', @response.body
+ end
+
def test_rjs_type_skips_layout
@request.env["HTTP_ACCEPT"] = "text/javascript"
get :all_types_with_layout