Permalink
Browse files

Use options hash from query object

  • Loading branch information...
1 parent 850292f commit 5ae5fb0b773ef067905352f51b98829868b2d681 tmertens committed Feb 3, 2014
Showing with 6 additions and 6 deletions.
  1. +6 −6 lib/capybara/node/matchers.rb
@@ -89,10 +89,10 @@ def has_no_selector?(*args)
# @raise [Capybara::ExpectationNotMet] If the selector does not exist
#
def assert_selector(*args)
- options = args.last.is_a?(Hash) ? args.last.dup : {}
- synchronize(Capybara::Query.new(*args).wait) do
+ query = Capybara::Query.new(*args)
+ synchronize(query.wait) do
result = all(*args)
- raise Capybara::ExpectationNotMet, result.failure_message if result.size == 0 && !Capybara::Helpers.expects_none?(options)
+ raise Capybara::ExpectationNotMet, result.failure_message if result.size == 0 && !Capybara::Helpers.expects_none?(query.options)
end
return true
end
@@ -114,14 +114,14 @@ def assert_selector(*args)
# @raise [Capybara::ExpectationNotMet] If the selector exists
#
def assert_no_selector(*args)
- options = args.last.is_a?(Hash) ? args.last.dup : {}
- synchronize(Capybara::Query.new(*args).wait) do
+ query = Capybara::Query.new(*args)
+ synchronize(query.wait) do
begin
result = all(*args)
rescue Capybara::ExpectationNotMet => e
return true
else
- if result.size > 0 || (result.size == 0 && Capybara::Helpers.expects_none?(options))
+ if result.size > 0 || (result.size == 0 && Capybara::Helpers.expects_none?(query.options))
raise(Capybara::ExpectationNotMet, result.negative_failure_message)
end
end

0 comments on commit 5ae5fb0

Please sign in to comment.