Module: Webrat::Matchers
- Defined in:
- lib/webrat/core/matchers/have_xpath.rb,
lib/webrat/core/matchers/have_content.rb,
lib/webrat/core/matchers/have_selector.rb
Defined Under Namespace
Classes: HasContent, HaveSelector, HaveXpath
Instance Method Summary collapse
-
#contain(content) ⇒ Object
Matches the contents of an HTML document with whatever string is supplied.
-
#have_selector(expected, &block) ⇒ Object
(also: #match_selector)
Matches HTML content against a CSS 3 selector.
-
#have_xpath(expected, nsmap = {}, &block) ⇒ Object
(also: #match_xpath)
Matches HTML content against an XPath query.
Instance Method Details
#contain(content) ⇒ Object
Matches the contents of an HTML document with whatever string is supplied
50 51 52 |
# File 'lib/webrat/core/matchers/have_content.rb', line 50 def contain(content) HasContent.new(content) end |
#have_selector(expected, &block) ⇒ Object Also known as: match_selector
Matches HTML content against a CSS 3 selector.
Parameters
- expected<String>
-
The CSS selector to look for.
Returns
- HaveSelector
-
A new have selector matcher.
31 32 33 |
# File 'lib/webrat/core/matchers/have_selector.rb', line 31 def have_selector(expected, &block) HaveSelector.new(expected, &block) end |
#have_xpath(expected, nsmap = {}, &block) ⇒ Object Also known as: match_xpath
Matches HTML content against an XPath query
Parameters
- expected<String>
-
The XPath query to look for.
Returns
- HaveXpath
-
A new have xpath matcher.
80 81 82 |
# File 'lib/webrat/core/matchers/have_xpath.rb', line 80 def have_xpath(expected, nsmap={}, &block) HaveXpath.new(expected, nsmap, &block) end |