aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/test_test.rb
diff options
context:
space:
mode:
authorJamis Buck <jamis@37signals.com>2006-09-10 02:51:38 +0000
committerJamis Buck <jamis@37signals.com>2006-09-10 02:51:38 +0000
commit3f0952d9df1db6e01ca608f30ba743f3e7d54dcc (patch)
tree2e55a07afd50a918e8472b1983ea628d16bb50cb /actionpack/test/controller/test_test.rb
parent5bf41ed8bcb8e9a15e2290e2e72a7aaffafa31b5 (diff)
downloadrails-3f0952d9df1db6e01ca608f30ba743f3e7d54dcc.tar.gz
rails-3f0952d9df1db6e01ca608f30ba743f3e7d54dcc.tar.bz2
rails-3f0952d9df1db6e01ca608f30ba743f3e7d54dcc.zip
Fix assert_tag so that :content => "foo" does not match substrings, but only exact strings. Use :content => /foo/ to match substrings. closes #2799
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5086 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller/test_test.rb')
-rw-r--r--actionpack/test/controller/test_test.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/test/controller/test_test.rb b/actionpack/test/controller/test_test.rb
index c9a30f9332..95c75bb744 100644
--- a/actionpack/test/controller/test_test.rb
+++ b/actionpack/test/controller/test_test.rb
@@ -253,9 +253,9 @@ HTML
process :test_html_output
# the output contains the string "Name"
- assert_tag :content => "Name"
+ assert_tag :content => /Name/
# the output does not contain the string "test"
- assert_no_tag :content => "test"
+ assert_no_tag :content => /test/
end
def test_assert_tag_multiple
@@ -301,6 +301,13 @@ HTML
:attributes => { :name => /^my$/, :type => 'text' }
end
+ def test_assert_tag_content_matching
+ @response.body = "<p>hello world</p>"
+ assert_tag :tag => "p", :content => "hello world"
+ assert_tag :tag => "p", :content => /hello/
+ assert_no_tag :tag => "p", :content => "hello"
+ end
+
def test_assert_generates
assert_generates 'controller/action/5', :controller => 'controller', :action => 'action', :id => '5'
end