Skip to content

Commit

Permalink
Use options hash from query object
Browse files Browse the repository at this point in the history
  • Loading branch information
tmertens committed Feb 3, 2014
1 parent 850292f commit 5ae5fb0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/capybara/node/matchers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5ae5fb0

Please sign in to comment.