Class: Capybara::Queries::CurrentPathQuery Private
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
BaseQuery
|
|
Instance Chain:
self,
BaseQuery
|
|
Inherits: |
Capybara::Queries::BaseQuery
|
Defined in: | lib/capybara/queries/current_path_query.rb |
Constant Summary
BaseQuery
- Inherited
Class Method Summary
- .new(expected_path, **options, &optional_filter_block) ⇒ CurrentPathQuery constructor Internal use only
BaseQuery
- Inherited
Instance Attribute Summary
BaseQuery
- Inherited
#expects_none? | Checks if a count of 0 is valid for the query Returns false if query does not have any count options specified. |
#options, #session_options, #session_options=, #count_specified? |
Instance Method Summary
- #failure_message Internal use only
- #negative_failure_message Internal use only
- #resolves_for?(session) ⇒ Boolean Internal use only
- #failure_message_helper(negated = '') private Internal use only
- #matches_filter_block?(url) ⇒ Boolean private Internal use only
- #valid_keys private Internal use only
BaseQuery
- Inherited
#failure_message | Generates a failure message from the query description and count options. |
#matches_count? | Checks if the given count matches the query count options. |
#negative_failure_message, #wait, #assert_valid_keys, #count_message, #occurrences |
Constructor Details
.new(expected_path, **options, &optional_filter_block) ⇒ CurrentPathQuery
# File 'lib/capybara/queries/current_path_query.rb', line 9
def initialize(expected_path, **, &optional_filter_block) super( ) @expected_path = expected_path @options = { url: !@expected_path.is_a?(Regexp) && !::Addressable::URI.parse(@expected_path || '').hostname.nil?, ignore_query: false }.merge( ) @filter_block = optional_filter_block assert_valid_keys end
Instance Method Details
#failure_message
[ GitHub ]# File 'lib/capybara/queries/current_path_query.rb', line 35
def end
#failure_message_helper(negated = '') (private)
[ GitHub ]# File 'lib/capybara/queries/current_path_query.rb', line 51
def (negated = '') verb = @expected_path.is_a?(Regexp) ? 'match' : 'equal' "expected #{@actual_path.inspect}#{negated} to #{verb} #{@expected_path.inspect}" end
#matches_filter_block?(url) ⇒ Boolean
(private)
# File 'lib/capybara/queries/current_path_query.rb', line 45
def matches_filter_block?(url) return true unless @filter_block @filter_block.call(url) end
#negative_failure_message
[ GitHub ]# File 'lib/capybara/queries/current_path_query.rb', line 39
def (' not') end
#resolves_for?(session) ⇒ Boolean
# File 'lib/capybara/queries/current_path_query.rb', line 20
def resolves_for?(session) uri = ::Addressable::URI.parse(session.current_url) @actual_path = ( [:ignore_query] ? uri&.omit(:query) : uri).then do |u| [:url] ? u&.to_s : u&.request_uri end res = if @expected_path.is_a? Regexp @actual_path.to_s.match?(@expected_path) else ::Addressable::URI.parse(@expected_path) == ::Addressable::URI.parse(@actual_path) end res && matches_filter_block?(uri) end
#valid_keys (private)
[ GitHub ]# File 'lib/capybara/queries/current_path_query.rb', line 56
def valid_keys %i[wait url ignore_query] end