Some doc fixes

This commit is contained in:
Andrey Botalov 2014-08-24 16:20:45 +03:00
parent 304e2fbfe1
commit 3285e11fb0
2 changed files with 19 additions and 16 deletions

View File

@ -41,7 +41,7 @@ module Capybara
# [always_include_port = Boolean] Whether the Rack server's port should automatically be inserted into every visited URL (Default: false)
# [asset_host = String] Where dynamic assets are hosted - will be prepended to relative asset locations if present (Default: nil)
# [run_server = Boolean] Whether to start a Rack server for the given Rack app (Default: true)
# [default_selector = :css/:xpath] Methods which take a selector use the given type by default (Default: CSS)
# [default_selector = :css/:xpath] Methods which take a selector use the given type by default (Default: :css)
# [default_wait_time = Integer] The number of seconds to wait for asynchronous processes to finish (Default: 2)
# [ignore_hidden_elements = Boolean] Whether to ignore hidden elements on the page (Default: true)
# [automatic_reload = Boolean] Whether to automatically reload elements as Capybara is waiting (Default: true)
@ -63,7 +63,7 @@ module Capybara
# Register a new driver for Capybara.
#
# Capybara.register_driver :rack_test do |app|
# Capybara::Driver::RackTest.new(app)
# Capybara::RackTest::Driver.new(app)
# end
#
# @param [Symbol] name The name of the new driver
@ -135,9 +135,9 @@ module Capybara
##
#
# Wraps the given string, which should contain an HTML document or fragment
# in a {Capybara::Node::Simple} which exposes all {Capybara::Node::Matchers} and
# {Capybara::Node::Finders}. This allows you to query any string containing
# HTML in the exact same way you would query the current document in a Capybara
# in a {Capybara::Node::Simple} which exposes all {Capybara::Node::Matchers},
# {Capybara::Node::Finders} and {Capybara::Node::DocumentMatchers}. This allows you to query
# any string containing HTML in the exact same way you would query the current document in a Capybara
# session. For example:
#
# node = Capybara.string <<-HTML
@ -149,8 +149,8 @@ module Capybara
#
# node.find('#projects').text # => 'Projects'
# node.has_selector?('li#home', :text => 'Home')
# node.has_selector?(:projects)
# node.find('ul').find('li').text # => 'Home'
# node.has_selector?('#projects')
# node.find('ul').find('li:first-child').text # => 'Home'
#
# @param [String] html An html fragment or document
# @return [Capybara::Node::Simple] A node which has Capybara's finders and matchers

View File

@ -16,12 +16,12 @@ module Capybara
##
#
# Finds a link by id or text and clicks it. Also looks at image
# Finds a link by id, text or title and clicks it. Also looks at image
# alt text inside the link.
#
# @param [String] locator Text or id of link
# @param [String] locator text, id, title or nested image's alt attribute
# @param options
# @option options [String] :href The value the href attribute must be
# @option options [String] :href The value the href attribute must equal
#
def click_link(locator, options={})
find(:link, locator, options).click
@ -29,9 +29,9 @@ module Capybara
##
#
# Finds a button by id, text or value and clicks it.
# Finds a button by id, text, value or title and clicks it.
#
# @param [String] locator Text, id or value of button
# @param [String] locator Text, id, value or title of button
#
def click_button(locator, options={})
find(:button, locator, options).click
@ -97,14 +97,17 @@ module Capybara
##
#
# Find a select box on the page and select a particular option from it. If the select
# box is a multiple select, +select+ can be called multiple times to select more than
# one option. The select box can be found via its name, id or label text.
# If `:from` option is present, `select` finds a select box on the page
# and selects a particular option from it.
# Otherwise it finds an option inside current scope and selects it.
# If the select box is a multiple select, +select+ can be called multiple times to select more than
# one option.
# The select box can be found via its name, id or label text. The option can be found by its text.
#
# page.select 'March', :from => 'Month'
#
# @param [String] value Which option to select
# @param [Hash{:from => String}] options The id, name or label of the select box
# @option options [String] :from The id, name or label of the select box
#
def select(value, options={})
if options.has_key?(:from)