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 <https://github.com/teamcapybara/capybara/pull/2190/files#r285646233>.

This change is extracted from #2190.
This commit is contained in:
Masafumi Koba 2019-05-22 15:13:50 +09:00
parent 84371c1182
commit 99bfeb71fe
No known key found for this signature in database
GPG Key ID: 60F83A73EFECA4BD
2 changed files with 5 additions and 9 deletions

View File

@ -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}.
##
#

View File

@ -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