From 5ae5fb0b773ef067905352f51b98829868b2d681 Mon Sep 17 00:00:00 2001 From: tmertens Date: Mon, 3 Feb 2014 08:10:58 -0600 Subject: [PATCH] Use options hash from query object --- lib/capybara/node/matchers.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/capybara/node/matchers.rb b/lib/capybara/node/matchers.rb index 1d43c7bc2..7f0cc2765 100644 --- a/lib/capybara/node/matchers.rb +++ b/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