Skip to content

Commit

Permalink
Reworked root and selector conditional assignment in css_select.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspth committed Jun 16, 2014
1 parent 5a14dbf commit bffa646
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions actionview/lib/action_view/testing/assertions/selector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,8 @@ module SelectorAssertions
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)
Expand Down

0 comments on commit bffa646

Please sign in to comment.