Module: Webrat::Selenium::Matchers
- Defined in:
- lib/webrat/selenium/matchers/have_tag.rb,
lib/webrat/selenium/matchers/have_xpath.rb,
lib/webrat/selenium/matchers/have_content.rb,
lib/webrat/selenium/matchers/have_selector.rb
Defined Under Namespace
Classes: HasContent, HaveSelector, HaveTag, HaveXpath
Instance Method Summary collapse
-
#assert_contain(content) ⇒ Object
Asserts that the body of the response contain the supplied string or regexp.
-
#assert_have_no_selector(expected, attributes = {}) ⇒ Object
Asserts that the body of the response does not contain the supplied string or regepx.
-
#assert_have_no_tag(name, attributes = {}) ⇒ Object
Asserts that the body of the response does not contain the supplied string or regepx.
- #assert_have_no_xpath(expected) ⇒ Object
-
#assert_have_selector(expected, attributes = {}) ⇒ Object
Asserts that the body of the response contains the supplied selector.
-
#assert_have_tag(name, attributes = {}) ⇒ Object
Asserts that the body of the response contains the supplied tag with the associated selectors.
- #assert_have_xpath(expected) ⇒ Object
-
#assert_not_contain(content) ⇒ Object
Asserts that the body of the response does not contain the supplied string or regepx.
-
#contain(content) ⇒ Object
Matches the contents of an HTML document with whatever string is supplied.
-
#have_selector(name, attributes = {}, &block) ⇒ Object
Matches HTML content against a CSS 3 selector.
- #have_tag(name, attributes = {}, &block) ⇒ Object (also: #match_tag)
- #have_xpath(xpath) ⇒ Object
Instance Method Details
#assert_contain(content) ⇒ Object
Asserts that the body of the response contain the supplied string or regexp
53 54 55 56 |
# File 'lib/webrat/selenium/matchers/have_content.rb', line 53 def assert_contain(content) hc = HasContent.new(content) assert hc.matches?(response), hc. end |
#assert_have_no_selector(expected, attributes = {}) ⇒ Object
Asserts that the body of the response does not contain the supplied string or regepx
68 69 70 71 |
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 68 def assert_have_no_selector(expected, attributes = {}) hs = HaveSelector.new(expected, attributes) assert !hs.matches?(response), hs. end |
#assert_have_no_tag(name, attributes = {}) ⇒ Object
Asserts that the body of the response does not contain the supplied string or regepx
42 43 44 45 |
# File 'lib/webrat/selenium/matchers/have_tag.rb', line 42 def assert_have_no_tag(name, attributes = {}) ht = HaveTag.new(name, attributes) assert !ht.matches?(response), ht. end |
#assert_have_no_xpath(expected) ⇒ Object
39 40 41 42 |
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 39 def assert_have_no_xpath(expected) hs = HaveXpath.new(expected) assert !hs.matches?(response), hs. end |
#assert_have_selector(expected, attributes = {}) ⇒ Object
Asserts that the body of the response contains the supplied selector
61 62 63 64 |
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 61 def assert_have_selector(expected, attributes = {}) hs = HaveSelector.new(expected, attributes) assert hs.matches?(response), hs. end |
#assert_have_tag(name, attributes = {}) ⇒ Object
Asserts that the body of the response contains the supplied tag with the associated selectors
35 36 37 38 |
# File 'lib/webrat/selenium/matchers/have_tag.rb', line 35 def assert_have_tag(name, attributes = {}) ht = HaveTag.new(name, attributes) assert ht.matches?(response), ht. end |
#assert_have_xpath(expected) ⇒ Object
34 35 36 37 |
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 34 def assert_have_xpath(expected) hs = HaveXpath.new(expected) assert hs.matches?(response), hs. end |
#assert_not_contain(content) ⇒ Object
Asserts that the body of the response does not contain the supplied string or regepx
60 61 62 63 |
# File 'lib/webrat/selenium/matchers/have_content.rb', line 60 def assert_not_contain(content) hc = HasContent.new(content) assert !hc.matches?(response), hc. end |
#contain(content) ⇒ Object
Matches the contents of an HTML document with whatever string is supplied
47 48 49 |
# File 'lib/webrat/selenium/matchers/have_content.rb', line 47 def contain(content) HasContent.new(content) end |
#have_selector(name, attributes = {}, &block) ⇒ Object
Matches HTML content against a CSS 3 selector.
Parameters
- expected<String>
-
The CSS selector to look for.
Returns
- HaveSelector
-
A new have selector matcher.
55 56 57 |
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 55 def have_selector(name, attributes = {}, &block) HaveSelector.new(name, attributes, &block) end |