aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2015-10-20 16:08:56 -0600
committerSean Griffin <sean@seantheprogrammer.com>2015-10-20 16:11:36 -0600
commitea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9 (patch)
treeff78ca5fc4a1ea01ab44ab8afb7d7f536cd7d289 /actionpack/test
parent61e65f606035778367cc52d7d0be190ff00e27ab (diff)
downloadrails-ea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9.tar.gz
rails-ea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9.tar.bz2
rails-ea9bc06c9a47b839d5e2db94ba6bf7e29c8f0ae9.zip
Merge pull request #20715 from simsalabim/feature/parse-rss-atom-as-xml
parse RSS/ATOM responses as XML, not HTML
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/integration_test.rb30
1 files changed, 17 insertions, 13 deletions
diff --git a/actionpack/test/controller/integration_test.rb b/actionpack/test/controller/integration_test.rb
index de7e800ac1..99f6f540a8 100644
--- a/actionpack/test/controller/integration_test.rb
+++ b/actionpack/test/controller/integration_test.rb
@@ -402,6 +402,8 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest
format.html { render plain: "OK", status: 200 }
format.js { render plain: "JS OK", status: 200 }
format.xml { render :xml => "<root></root>", :status => 200 }
+ format.rss { render :xml => "<root></root>", :status => 200 }
+ format.atom { render :xml => "<root></root>", :status => 200 }
end
end
@@ -458,19 +460,21 @@ class IntegrationProcessTest < ActionDispatch::IntegrationTest
end
end
- def test_get_xml
- with_test_route_set do
- get "/get", params: {}, headers: {"HTTP_ACCEPT" => "application/xml"}
- assert_equal 200, status
- assert_equal "OK", status_message
- assert_response 200
- assert_response :success
- assert_response :ok
- assert_equal({}, cookies.to_hash)
- assert_equal "<root></root>", body
- assert_equal "<root></root>", response.body
- assert_instance_of Nokogiri::XML::Document, html_document
- assert_equal 1, request_count
+ def test_get_xml_rss_atom
+ %w[ application/xml application/rss+xml application/atom+xml ].each do |mime_string|
+ with_test_route_set do
+ get "/get", {}, {"HTTP_ACCEPT" => mime_string}
+ assert_equal 200, status
+ assert_equal "OK", status_message
+ assert_response 200
+ assert_response :success
+ assert_response :ok
+ assert_equal({}, cookies.to_hash)
+ assert_equal "<root></root>", body
+ assert_equal "<root></root>", response.body
+ assert_instance_of Nokogiri::XML::Document, html_document
+ assert_equal 1, request_count
+ end
end
end