Module: Capybara::Node::DocumentMatchers
Instance Method Summary collapse
-
#assert_no_title(title, options = {}) ⇒ true
Asserts that the page doesn’t have the given title.
-
#assert_title(title, options = {}) ⇒ true
Asserts that the page has the given title.
-
#has_no_title?(title, options = {}) ⇒ Boolean
Checks if the page doesn’t have the given title.
-
#has_title?(title, options = {}) ⇒ Boolean
Checks if the page has the given title.
Instance Method Details
#assert_no_title(string, options = {}) ⇒ true #assert_no_title(regexp, options = {}) ⇒ true
Asserts that the page doesn’t have the given title.
33 34 35 36 37 38 39 40 41 |
# File 'lib/capybara/node/document_matchers.rb', line 33 def assert_no_title(title, = {}) query = Capybara::Queries::TitleQuery.new(title, ) synchronize(query.wait) do if query.resolves_for?(self) raise Capybara::ExpectationNotMet, query. end end return true end |
#assert_title(string, options = {}) ⇒ true #assert_title(regexp, options = {}) ⇒ true
Asserts that the page has the given title.
16 17 18 19 20 21 22 23 24 |
# File 'lib/capybara/node/document_matchers.rb', line 16 def assert_title(title, = {}) query = Capybara::Queries::TitleQuery.new(title, ) synchronize(query.wait) do unless query.resolves_for?(self) raise Capybara::ExpectationNotMet, query. end end return true end |
#has_no_title?(string, options = {}) ⇒ Boolean #has_no_title?(regexp, options = {}) ⇒ Boolean
Checks if the page doesn’t have the given title.
61 62 63 64 65 |
# File 'lib/capybara/node/document_matchers.rb', line 61 def has_no_title?(title, = {}) assert_no_title(title, ) rescue Capybara::ExpectationNotMet return false end |
#has_title?(string, options = {}) ⇒ Boolean #has_title?(regexp, options = {}) ⇒ Boolean
Checks if the page has the given title.
49 50 51 52 53 |
# File 'lib/capybara/node/document_matchers.rb', line 49 def has_title?(title, = {}) assert_title(title, ) rescue Capybara::ExpectationNotMet return false end |