Module: Locator::Matcher
- Defined in:
- lib/locator/matcher.rb,
lib/locator/matcher/have_tag.rb
Defined Under Namespace
Classes: HaveTag
Instance Method Summary collapse
-
#assert_contain(*args) ⇒ Object
Asserts that the response body contains the given string or regexp.
-
#assert_have_css(html, *args, &block) ⇒ Object
Asserts that the response body matches the given CSS selector.
-
#assert_have_no_css(html, *args, &block) ⇒ Object
Asserts that the response body does not match the given CSS selector.
- #assert_have_no_tag(html, *args, &block) ⇒ Object
-
#assert_have_no_xpath(html, *args, &block) ⇒ Object
Asserts that the response body does not match the given XPath.
- #assert_have_tag(html, *args, &block) ⇒ Object
-
#assert_have_xpath(html, *args, &block) ⇒ Object
Asserts that the response body matches the given XPath.
-
#assert_not_contain(*args) ⇒ Object
Asserts that the response body does not contain the given string or regexp.
-
#contain(*args) ⇒ Object
Matches an HTML document with whatever string is given.
-
#have_css(css, options = {}, &block) ⇒ Object
Matches HTML content against a CSS selector.
- #have_tag(*args, &block) ⇒ Object
-
#have_xpath(xpath, options = {}, &block) ⇒ Object
Matches HTML content against an XPath.
Instance Method Details
#assert_contain(*args) ⇒ Object
Asserts that the response body contains the given string or regexp
11 12 13 14 |
# File 'lib/locator/matcher.rb', line 11 def assert_contain(*args) matcher = contain(*args) assert matcher.matches?(response.body), matcher. end |
#assert_have_css(html, *args, &block) ⇒ Object
Asserts that the response body matches the given CSS selector
59 60 61 62 |
# File 'lib/locator/matcher.rb', line 59 def assert_have_css(html, *args, &block) matcher = have_css(*args, &block) assert matcher.matches?(response.body), matcher. end |
#assert_have_no_css(html, *args, &block) ⇒ Object
Asserts that the response body does not match the given CSS selector
65 66 67 68 |
# File 'lib/locator/matcher.rb', line 65 def assert_have_no_css(html, *args, &block) matcher = have_css(*args, &block) assert !matcher.matches?(response.body), matcher. end |
#assert_have_no_tag(html, *args, &block) ⇒ Object
31 32 33 34 |
# File 'lib/locator/matcher.rb', line 31 def assert_have_no_tag(html, *args, &block) matcher = have_tag(*args, &block) assert !matcher.matches?(response.body), matcher. end |
#assert_have_no_xpath(html, *args, &block) ⇒ Object
Asserts that the response body does not match the given XPath
48 49 50 51 |
# File 'lib/locator/matcher.rb', line 48 def assert_have_no_xpath(html, *args, &block) matcher = have_xpath(*args, &block) assert !matcher.matches?(response.body), matcher. end |
#assert_have_tag(html, *args, &block) ⇒ Object
26 27 28 29 |
# File 'lib/locator/matcher.rb', line 26 def assert_have_tag(html, *args, &block) matcher = have_tag(*args, &block) assert matcher.matches?(response.body), matcher. end |
#assert_have_xpath(html, *args, &block) ⇒ Object
Asserts that the response body matches the given XPath
42 43 44 45 |
# File 'lib/locator/matcher.rb', line 42 def assert_have_xpath(html, *args, &block) matcher = have_xpath(*args, &block) assert matcher.matches?(response.body), matcher. end |
#assert_not_contain(*args) ⇒ Object
Asserts that the response body does not contain the given string or regexp
17 18 19 20 |
# File 'lib/locator/matcher.rb', line 17 def assert_not_contain(*args) matcher = contain(*args) assert !matcher.matches?(response.body), matcher. end |
#contain(*args) ⇒ Object
Matches an HTML document with whatever string is given
6 7 8 |
# File 'lib/locator/matcher.rb', line 6 def contain(*args) HaveTag.new(*args) end |
#have_css(css, options = {}, &block) ⇒ Object
Matches HTML content against a CSS selector.
54 55 56 |
# File 'lib/locator/matcher.rb', line 54 def have_css(css, = {}, &block) HaveTag.new(.delete(:content), .merge(:css => css), &block) end |