aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-10-09 00:20:31 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-10-09 00:20:31 +0000
commit3c6b7a219142907416780501dd8e7d068a802bc4 (patch)
treede45cc4ded8ebb4c7d7ef0ffa4674f4a8bf064c9 /actionpack/test/controller
parent717e26dd0eceb96093962882f7ed4ca06cf15db2 (diff)
downloadrails-3c6b7a219142907416780501dd8e7d068a802bc4.tar.gz
rails-3c6b7a219142907416780501dd8e7d068a802bc4.tar.bz2
rails-3c6b7a219142907416780501dd8e7d068a802bc4.zip
Fixed that assert_select selects the wrong tag by its contents (closes #6332) [jgarber]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5240 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/assert_select_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actionpack/test/controller/assert_select_test.rb b/actionpack/test/controller/assert_select_test.rb
index 52ef688514..956aa4e71f 100644
--- a/actionpack/test/controller/assert_select_test.rb
+++ b/actionpack/test/controller/assert_select_test.rb
@@ -186,6 +186,23 @@ class AssertSelectTest < Test::Unit::TestCase
end
+ def test_assert_select_text_match
+ render_html %Q{<div id="1"><span>foo</span></div><div id="2"><span>bar</span></div>}
+ assert_select "div" do
+ assert_nothing_raised { assert_select "div", "foo" }
+ assert_nothing_raised { assert_select "div", "bar" }
+ assert_nothing_raised { assert_select "div", /\w*/ }
+ assert_nothing_raised { assert_select "div", /\w*/, :count=>2 }
+ assert_raises(AssertionFailedError) { assert_select "div", :text=>"foo", :count=>2 }
+ assert_nothing_raised { assert_select "div", :html=>"<span>bar</span>" }
+ assert_nothing_raised { assert_select "div", :html=>"<span>bar</span>" }
+ assert_nothing_raised { assert_select "div", :html=>/\w*/ }
+ assert_nothing_raised { assert_select "div", :html=>/\w*/, :count=>2 }
+ assert_raises(AssertionFailedError) { assert_select "div", :html=>"<span>foo</span>", :count=>2 }
+ end
+ end
+
+
def test_assert_select_from_rjs
render_rjs do |page|
page.replace_html "test", "<div id=\"1\">foo</div>\n<div id=\"2\">foo</div>"