From 3c6b7a219142907416780501dd8e7d068a802bc4 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 9 Oct 2006 00:20:31 +0000 Subject: 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 --- actionpack/test/controller/assert_select_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'actionpack/test/controller') 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{
foo
bar
} + 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=>"bar" } + assert_nothing_raised { assert_select "div", :html=>"bar" } + 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=>"foo", :count=>2 } + end + end + + def test_assert_select_from_rjs render_rjs do |page| page.replace_html "test", "
foo
\n
foo
" -- cgit v1.2.3