diff --git a/lib/capybara/queries/base_query.rb b/lib/capybara/queries/base_query.rb index 2073d826..0bbb7f1d 100644 --- a/lib/capybara/queries/base_query.rb +++ b/lib/capybara/queries/base_query.rb @@ -12,11 +12,7 @@ module Capybara end def self.wait(options) - if options.has_key?(:wait) - options[:wait] || 0 - else - Capybara.default_max_wait_time - end + options.fetch(:wait, Capybara.default_max_wait_time) || 0 end private diff --git a/lib/capybara/queries/selector_query.rb b/lib/capybara/queries/selector_query.rb index 3a573158..a6f423da 100644 --- a/lib/capybara/queries/selector_query.rb +++ b/lib/capybara/queries/selector_query.rb @@ -83,23 +83,15 @@ module Capybara def exact? return false if !supports_exact? - if options.has_key?(:exact) - @options[:exact] - else - Capybara.exact - end + options.fetch(:exact, Capybara.exact) end def match - if options.has_key?(:match) - @options[:match] - else - Capybara.match - end + options.fetch(:match, Capybara.match) end def xpath(exact=nil) - exact = self.exact? if exact == nil + exact = self.exact? if exact.nil? if @expression.respond_to?(:to_xpath) and exact @expression.to_xpath(:exact) else