diff options
author | Timm <kaspth@gmail.com> | 2013-08-01 21:11:48 +0200 |
---|---|---|
committer | Timm <kaspth@gmail.com> | 2014-06-16 21:03:59 +0200 |
commit | 77d0333c08d3124120b604c821196db688ee9722 (patch) | |
tree | 522665227ab1bbfe0514d871ceeadac0379aa8b8 /actionpack | |
parent | ea5f3ba0e24f8f554ff256f1f58e437cc3934bdd (diff) | |
download | rails-77d0333c08d3124120b604c821196db688ee9722.tar.gz rails-77d0333c08d3124120b604c821196db688ee9722.tar.bz2 rails-77d0333c08d3124120b604c821196db688ee9722.zip |
Wrapped element to search in NodeSet. Changed selectors to selector.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_dispatch/testing/assertions/selector.rb | 8 |
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. |