aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_dispatch/testing/assertions/selector.rb8
1 files changed, 5 insertions, 3 deletions
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:
+ # <element div>.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.