From 77d0333c08d3124120b604c821196db688ee9722 Mon Sep 17 00:00:00 2001 From: Timm Date: Thu, 1 Aug 2013 21:11:48 +0200 Subject: Wrapped element to search in NodeSet. Changed selectors to selector. --- actionpack/lib/action_dispatch/testing/assertions/selector.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'actionpack/lib/action_dispatch/testing/assertions/selector.rb') diff --git a/actionpack/lib/action_dispatch/testing/assertions/selector.rb b/actionpack/lib/action_dispatch/testing/assertions/selector.rb index 8d2a30ca8d..04628539e8 100644 --- a/actionpack/lib/action_dispatch/testing/assertions/selector.rb +++ b/actionpack/lib/action_dispatch/testing/assertions/selector.rb @@ -60,12 +60,14 @@ module ActionDispatch raise ArgumentError, "you at least need a selector" if args.empty? if args.first.is_a?(String) - root, selectors = response_from_page, args.first + root, selector = response_from_page, args.first else - root, selectors = args.shift, args.first + root, selector = args.shift, args.first end - root.css(selectors) + # wrap in NodeSet to avoid this: + # .css('div') => no matches + Nokogiri::XML::NodeSet.new(root.document, [root]).css(selector) end # An assertion that selects elements and makes one or more equality tests. -- cgit v1.2.3