Method: Capybara::Node::DocumentMatchers#assert_title

Defined in:
lib/capybara/node/document_matchers.rb

#assert_title(string, **options) ⇒ true #assert_title(regexp, **options) ⇒ true

Asserts that the page has the given title.

Overloads:

  • #assert_title(string, **options) ⇒ true

    Parameters:

    • string (String)

      The string that title should include

  • #assert_title(regexp, **options) ⇒ true

    Parameters:

    • regexp (Regexp)

      The regexp that title should match to

Parameters:

  • options (Hash)

    a customizable set of options

Options Hash (**options):

  • :wait (Numeric) — default: Capybara.default_max_wait_time

    Maximum time that Capybara will wait for title to eq/match given string/regexp argument

  • :exact (Boolean) — default: false

    When passed a string should the match be exact or just substring

Returns:

  • (true)

Raises:



19
20
21
22
23
# File 'lib/capybara/node/document_matchers.rb', line 19

def assert_title(title, **options)
  _verify_title(title, options) do |query|
    raise Capybara::ExpectationNotMet, query.failure_message unless query.resolves_for?(self)
  end
end