/usr/lib/ruby/vendor_ruby/capybara/node/document_matchers.rb is in ruby-capybara 2.5.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | module Capybara
module Node
module DocumentMatchers
##
# 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_max_wait_time) Maximum 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]
#
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
##
# 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]
#
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
##
# Checks if the page has the given title.
#
# @macro title_query_params
# @return [Boolean]
#
def has_title?(title, options = {})
assert_title(title, options)
rescue Capybara::ExpectationNotMet
return false
end
##
# Checks if the page doesn't have the given title.
#
# @macro title_query_params
# @return [Boolean]
#
def has_no_title?(title, options = {})
assert_no_title(title, options)
rescue Capybara::ExpectationNotMet
return false
end
end
end
end
|