Allow assert_tag(:conditions) to match the empty string when a tag has no children. Closes #2959. [Jamis Buck]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3154 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2005-11-21 21:02:10 +00:00
parent f9b199040c
commit f783d50cf8
3 changed files with 10 additions and 2 deletions

@ -1,5 +1,7 @@
*SVN*
* Allow assert_tag(:conditions) to match the empty string when a tag has no children. Closes #2959. [Jamis Buck]
* Update html-scanner to handle CDATA sections better. Closes #2970. [Jamis Buck]
* Don't put flash in session if sessions are disabled. [Jeremy Kemper]

@ -412,7 +412,13 @@ def match(conditions)
conditions = validate_conditions(conditions)
# check content of child nodes
return false unless children.find { |child| child.match(conditions[:content]) } if conditions[:content]
if conditions[:content]
if children.empty?
return false unless match_condition("", conditions[:content])
else
return false unless children.find { |child| child.match(conditions[:content]) }
end
end
# test the name
return false unless match_condition(@name, conditions[:tag]) if conditions[:tag]

@ -3,7 +3,7 @@ module Version #:nodoc:
MAJOR = 0
MINOR = 5
TINY = 2
TINY = 3
STRING = [ MAJOR, MINOR, TINY ].join(".")