aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/mime_responds_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-12 05:13:55 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-12 05:13:55 +0000
commit9e2932f816b0cac68361bb5adcdad3e4c3caeb04 (patch)
tree8258ef1eb9c811af61d54c24acb417416afd3878 /actionpack/test/controller/mime_responds_test.rb
parentde660957a50227ef71a7c16524ccec2c45b980b5 (diff)
downloadrails-9e2932f816b0cac68361bb5adcdad3e4c3caeb04.tar.gz
rails-9e2932f816b0cac68361bb5adcdad3e4c3caeb04.tar.bz2
rails-9e2932f816b0cac68361bb5adcdad3e4c3caeb04.zip
Assume that we accept what we give [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3843 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/mime_responds_test.rb')
-rw-r--r--actionpack/test/controller/mime_responds_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionpack/test/controller/mime_responds_test.rb b/actionpack/test/controller/mime_responds_test.rb
index f2aa45a168..184110aad1 100644
--- a/actionpack/test/controller/mime_responds_test.rb
+++ b/actionpack/test/controller/mime_responds_test.rb
@@ -48,6 +48,14 @@ class RespondToController < ActionController::Base
end
end
+ def made_for_content_type
+ respond_to do |type|
+ type.rss { render :text => "RSS" }
+ type.atom { render :text => "ATOM" }
+ type.all { render :text => "Nothing" }
+ end
+ end
+
def rescue_action(e)
raise unless ActionController::MissingTemplate === e
end
@@ -137,4 +145,14 @@ class MimeControllerTest < Test::Unit::TestCase
get :using_argument_defaults
assert_equal "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<person>\n <name>David</name>\n</person>\n", @response.body
end
+
+ def test_with_content_type
+ @request.env["CONTENT_TYPE"] = "application/atom+xml"
+ get :made_for_content_type
+ assert_equal "ATOM", @response.body
+
+ @request.env["CONTENT_TYPE"] = "application/rss+xml"
+ get :made_for_content_type
+ assert_equal "RSS", @response.body
+ end
end \ No newline at end of file