diff options
author | Michael Koziarski <michael@koziarski.com> | 2007-09-08 01:32:16 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2007-09-08 01:32:16 +0000 |
commit | 32553a2d76f4520e1456d5463c691310c22ebd2b (patch) | |
tree | 3d8e2969c2f134d8aabaeeb540f3e6b76dcfd428 /actionpack/test | |
parent | fe31f0e066ef8969366e692d21127a60a246d5a0 (diff) | |
download | rails-32553a2d76f4520e1456d5463c691310c22ebd2b.tar.gz rails-32553a2d76f4520e1456d5463c691310c22ebd2b.tar.bz2 rails-32553a2d76f4520e1456d5463c691310c22ebd2b.zip |
Fix assert_select for XML documents. Closes #8173. [dasil003]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7417 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/test_test.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb index 937f9e5a91..10818fe1c9 100644 --- a/actionpack/test/controller/test_test.rb +++ b/actionpack/test/controller/test_test.rb @@ -45,6 +45,16 @@ class TestTest < Test::Unit::TestCase </html> HTML end + + def test_xml_output + response.content_type = "application/xml" + render :text => <<XML +<?xml version="1.0" encoding="UTF-8"?> +<root> + <area>area is an empty tag in HTML, raising an error if not in xml mode</area> +</root> +XML + end def test_only_one_param render :text => (params[:left] && params[:right]) ? "EEP, Both here!" : "OK" @@ -301,6 +311,20 @@ HTML :children => { :count => 1, :only => { :tag => "img" } } } } end + + def test_should_not_impose_childless_html_tags_in_xml + process :test_xml_output + + begin + $stderr = StringIO.new + assert_select 'area' #This will cause a warning if content is processed as HTML + $stderr.rewind && err = $stderr.read + ensure + $stderr = STDERR + end + + assert err.empty? + end def test_assert_tag_attribute_matching @response.body = '<input type="text" name="my_name">' |