Module: Capybara::Node::DocumentMatchers

### Home Classes Methods

### In Files

- lib/capybara/node/document_matchers.rb

### Methods

- #assert_no_title
- #assert_title
- #has_no_title?
- #has_title?

### Files

- another_test_file.txt
- test_file.txt

### Class/Module Index

Quicksearch

- Capybara
- Capybara::Ambiguous
- Capybara::CapybaraError
- Capybara::DSL
- Capybara::Driver
- Capybara::Driver::Base
- Capybara::Driver::Node
- Capybara::DriverNotFoundError
- Capybara::ElementNotFound
- Capybara::ExpectationNotMet
- Capybara::Features
- Capybara::FileNotFound
- Capybara::FrozenInTime
- Capybara::Helpers
- Capybara::InfiniteRedirectError
- Capybara::ModalNotFound
- Capybara::Node
- Capybara::Node::Actions
- Capybara::Node::Base
- Capybara::Node::Document
- Capybara::Node::DocumentMatchers
- Capybara::Node::Element
- Capybara::Node::Finders
- Capybara::Node::Matchers
- Capybara::Node::Simple
- Capybara::NotSupportedByDriverError
- Capybara::Queries
- Capybara::Queries::BaseQuery
- Capybara::Queries::TextQuery
- Capybara::Queries::TitleQuery
- Capybara::Query
- Capybara::RSpecMatchers
- Capybara::RSpecMatchers::BecomeClosed
- Capybara::RSpecMatchers::HaveSelector
- Capybara::RSpecMatchers::HaveText
- Capybara::RSpecMatchers::HaveTitle
- Capybara::RSpecMatchers::Matcher
- Capybara::RackTest
- Capybara::RackTest::Browser
- Capybara::RackTest::CSSHandlers
- Capybara::RackTest::Driver
- Capybara::RackTest::Form
- Capybara::RackTest::Form::NilUploadedFile
- Capybara::RackTest::Node
- Capybara::ReadOnlyElementError
- Capybara::Result
- Capybara::ScopeError
- Capybara::Selector
- Capybara::Selector::Filter
- Capybara::Selenium
- Capybara::Selenium::Driver
- Capybara::Selenium::Node
- Capybara::Server
- Capybara::Server::Middleware
- Capybara::Session
- Capybara::SpecHelper
- Capybara::UnselectNotAllowed
- Capybara::Window
- Capybara::WindowError
- TestApp
- TestApp::TestAppError
- Object

No matching classes.

# Capybara::Node::DocumentMatchers

### Public Instance Methods

assert_no_title(title, options = {}) click to toggle source

Asserts that the page doesn't have the given title.

@macro title_query_params @raise [Capybara::ExpectationNotMet] if the assertion hasn't succeeded during wait time @return [true]

    # File lib/capybara/node/document_matchers.rb, line 33
    def assert_no_title(title, options = {})
      query = Capybara::Queries::TitleQuery.new(title, options)
      synchronize(query.wait) do
        if query.resolves_for?(self)
          raise Capybara::ExpectationNotMet, query.negative_failure_message
        end
      end
      return true
    end

assert_title(title, options = {}) click to toggle source

Asserts that the page has the given title.

@!macro title_query_params

    @overload $0(string, options = {})
      @param string [String]           The string that title should include
    @overload $0(regexp, options = {})
      @param regexp [Regexp]           The regexp that title should match to
    @option options [Numeric] :wait (Capybara.default_wait_time) Time that Capybara will wait for title to eq/match given string/regexp argument

@raise [Capybara::ExpectationNotMet] if the assertion hasn't succeeded during wait time @return [true]

    # File lib/capybara/node/document_matchers.rb, line 16
    def assert_title(title, options = {})
      query = Capybara::Queries::TitleQuery.new(title, options)
      synchronize(query.wait) do
        unless query.resolves_for?(self)
          raise Capybara::ExpectationNotMet, query.failure_message
        end
      end
      return true
    end

has_no_title?(title, options = {}) click to toggle source

Checks if the page doesn't have the given title.

@macro title_query_params @return [Boolean]

    # File lib/capybara/node/document_matchers.rb, line 61
    def has_no_title?(title, options = {})
      assert_no_title(title, options)
    rescue Capybara::ExpectationNotMet
      return false
    end

has_title?(title, options = {}) click to toggle source

Checks if the page has the given title.

@macro title_query_params @return [Boolean]

    # File lib/capybara/node/document_matchers.rb, line 49
    def has_title?(title, options = {})
      assert_title(title, options)
    rescue Capybara::ExpectationNotMet
      return false
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.