aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/assertions/action_pack_assertions.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-02-18 17:13:57 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-02-18 17:13:57 +0000
commit37249f6a864d6f54cb66168fd2e51b409fb5bc63 (patch)
treedbc1f788d61b15d2aa00fca2b841e3dca9d616b7 /actionpack/lib/action_controller/assertions/action_pack_assertions.rb
parent5fc48bc54fc82f350ab4838ca3cc0eff158225fc (diff)
downloadrails-37249f6a864d6f54cb66168fd2e51b409fb5bc63.tar.gz
rails-37249f6a864d6f54cb66168fd2e51b409fb5bc63.tar.bz2
rails-37249f6a864d6f54cb66168fd2e51b409fb5bc63.zip
Fixed that assert_template_xpath_matches did not indicate when a path was not found #658 [Eric Hodel]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@665 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/assertions/action_pack_assertions.rb')
-rw-r--r--actionpack/lib/action_controller/assertions/action_pack_assertions.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/assertions/action_pack_assertions.rb b/actionpack/lib/action_controller/assertions/action_pack_assertions.rb
index a8819550e6..c9a1aae174 100644
--- a/actionpack/lib/action_controller/assertions/action_pack_assertions.rb
+++ b/actionpack/lib/action_controller/assertions/action_pack_assertions.rb
@@ -217,7 +217,14 @@ module Test #:nodoc:
response = acquire_assertion_target
xml, matches = REXML::Document.new(response.body), []
xml.elements.each(expression) { |e| matches << e.text }
- matches = matches.first if matches.length < 2
+ if matches.empty? then
+ msg = build_message(message, "<?> not found in document",
+ expression)
+ flunk(msg)
+ return
+ elsif matches.length < 2 then
+ matches = matches.first
+ end
msg = build_message(message, "<?> found <?>, not <?>", expression, matches, expected)
assert_block(msg) { matches == expected }