From 99bfeb71fea11c7b90f451af74f2a5b3e35e90e1 Mon Sep 17 00:00:00 2001 From: Masafumi Koba Date: Wed, 22 May 2019 15:13:50 +0900 Subject: [PATCH] Improve `waiting_behavior` YARD macro Summary: - Unify the almost same macro definitions defined both in `Capybara::Node::Actions` and `Capybara::Node::Finders`. - Change the `+find+` word in the macro to `this method`. - See . This change is extracted from #2190. --- lib/capybara/node/actions.rb | 5 +++-- lib/capybara/node/finders.rb | 9 ++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/capybara/node/actions.rb b/lib/capybara/node/actions.rb index cf86f52d..21c711f1 100644 --- a/lib/capybara/node/actions.rb +++ b/lib/capybara/node/actions.rb @@ -6,9 +6,10 @@ module Capybara # @!macro waiting_behavior # If the driver is capable of executing JavaScript, this method will wait for a set amount of time # and continuously retry finding the element until either the element is found or the time - # expires. The length of time +find+ will wait is controlled through {Capybara.default_max_wait_time} + # expires. The length of time this method will wait is controlled through {Capybara.configure default_max_wait_time}. # - # @option options [false, true, Numeric] wait (Capybara.default_max_wait_time) Maximum time to wait for matching element to appear. + # @option options [false, true, Numeric] wait + # Maximum time to wait for matching element to appear. Defaults to {Capybara.configure default_max_wait_time}. ## # diff --git a/lib/capybara/node/finders.rb b/lib/capybara/node/finders.rb index 0e769350..fb351933 100644 --- a/lib/capybara/node/finders.rb +++ b/lib/capybara/node/finders.rb @@ -8,19 +8,14 @@ module Capybara # Find an {Capybara::Node::Element} based on the given arguments. +find+ will raise an error if the element # is not found. # - # @!macro waiting_behavior - # If the driver is capable of executing JavaScript, this method will wait for a set amount of time - # and continuously retry finding the element until either the element is found or the time - # expires. The length of time +find+ will wait is controlled through {Capybara.default_max_wait_time} - # and defaults to 2 seconds. - # @option options [false, true, Numeric] wait (Capybara.default_max_wait_time) Maximum time to wait for matching element to appear. - # # page.find('#foo').find('.bar') # page.find(:xpath, './/div[contains(., "bar")]') # page.find('li', text: 'Quox').click_link('Delete') # # @param (see Capybara::Node::Finders#all) # + # @macro waiting_behavior + # # @!macro system_filters # @option options [String, Regexp] text Only find elements which contain this text or match this regexp # @option options [String, Boolean] exact_text (Capybara.exact_text) When String the elements contained text must match exactly, when Boolean controls whether the :text option must match exactly