Class: Capybara::Queries::TitleQuery Private

Inherits:
BaseQuery
  • Object
show all
Defined in:
lib/capybara/queries/title_query.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary

Constants inherited from BaseQuery

BaseQuery::COUNT_KEYS

Instance Attribute Summary

Attributes inherited from BaseQuery

#options

Instance Method Summary collapse

Methods inherited from BaseQuery

#wait

Constructor Details

#initialize(expected_title, options = {}) ⇒ TitleQuery

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TitleQuery.



5
6
7
8
9
10
11
12
13
# File 'lib/capybara/queries/title_query.rb', line 5

def initialize(expected_title, options = {})
  @expected_title = expected_title
  @options = options
  unless @expected_title.is_a?(Regexp)
    @expected_title = Capybara::Helpers.normalize_whitespace(@expected_title)
  end
  @search_regexp = Capybara::Helpers.to_regexp(@expected_title)
  assert_valid_keys
end

Instance Method Details

#failure_messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



20
21
22
# File 'lib/capybara/queries/title_query.rb', line 20

def failure_message
  failure_message_helper
end

#negative_failure_messageObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
# File 'lib/capybara/queries/title_query.rb', line 24

def negative_failure_message
  failure_message_helper(' not')
end

#resolves_for?(node) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/capybara/queries/title_query.rb', line 15

def resolves_for?(node)
  @actual_title = node.title
  @actual_title.match(@search_regexp)
end