diff options
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/testing/assertions/selector.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/actionview/lib/action_view/testing/assertions/selector.rb b/actionview/lib/action_view/testing/assertions/selector.rb index dc847e5ccf..c2ea25c8a3 100644 --- a/actionview/lib/action_view/testing/assertions/selector.rb +++ b/actionview/lib/action_view/testing/assertions/selector.rb @@ -49,11 +49,8 @@ module ActionView def css_select(*args) raise ArgumentError, "you at least need a selector" if args.empty? - if args.first.is_a?(String) - root, selector = response_from_page, args.first - else - root, selector = args.shift, args.first - end + root = args.size == 1 ? response_from_page : args.shift + selector = args.first root.css(selector).tap do |matches| if matches.empty? && root.matches?(selector) |