diff options
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/assertions/action_pack_assertions.rb | 9 |
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 } |