Webrat::Matchers

Public Instance Methods

assert_contain(content) click to toggle source

Asserts that the body of the response contain the supplied string or regexp

# File lib/webrat/core/matchers/have_content.rb, line 55
def assert_contain(content)
  hc = HasContent.new(content)
  assert hc.matches?(response_body), hc.failure_message
end
assert_have_no_selector(name, attributes = {}, &block) click to toggle source

Asserts that the body of the response does not contain the supplied string or regepx

# File lib/webrat/core/matchers/have_selector.rb, line 68
def assert_have_no_selector(name, attributes = {}, &block)
  matcher = HaveSelector.new(name, attributes, &block)
  assert !matcher.matches?(response_body), matcher.negative_failure_message
end
assert_have_no_xpath(expected, options = {}, &block) click to toggle source
# File lib/webrat/core/matchers/have_xpath.rb, line 118
def assert_have_no_xpath(expected, options = {}, &block)
  hs = HaveXpath.new(expected, options, &block)
  assert !hs.matches?(response_body), hs.negative_failure_message
end
assert_have_selector(name, attributes = {}, &block) click to toggle source

Asserts that the body of the response contains the supplied selector

# File lib/webrat/core/matchers/have_selector.rb, line 61
def assert_have_selector(name, attributes = {}, &block)
  matcher = HaveSelector.new(name, attributes, &block)
  assert matcher.matches?(response_body), matcher.failure_message
end
assert_have_xpath(expected, options = {}, &block) click to toggle source
# File lib/webrat/core/matchers/have_xpath.rb, line 113
def assert_have_xpath(expected, options = {}, &block)
  hs = HaveXpath.new(expected, options, &block)
  assert hs.matches?(response_body), hs.failure_message
end
assert_not_contain(content) click to toggle source

Asserts that the body of the response does not contain the supplied string or regepx

# File lib/webrat/core/matchers/have_content.rb, line 62
def assert_not_contain(content)
  hc = HasContent.new(content)
  assert !hc.matches?(response_body), hc.negative_failure_message
end
contain(content) click to toggle source

Matches the contents of an HTML document with whatever string is supplied

# File lib/webrat/core/matchers/have_content.rb, line 49
def contain(content)
  HasContent.new(content)
end
have_selector(name, attributes = {}, &block) click to toggle source

Matches HTML content against a CSS 3 selector.

Parameters

expected<String>

The CSS selector to look for.

Returns

HaveSelector

A new have selector matcher.

# File lib/webrat/core/matchers/have_selector.rb, line 53
def have_selector(name, attributes = {}, &block)
  HaveSelector.new(name, attributes, &block)
end
Also aliased as: match_selector
have_xpath(expected, options = {}, &block) click to toggle source

Matches HTML content against an XPath query

Parameters

expected<String>

The XPath query to look for.

Returns

HaveXpath

A new have xpath matcher.

# File lib/webrat/core/matchers/have_xpath.rb, line 108
def have_xpath(expected, options = {}, &block)
  HaveXpath.new(expected, options, &block)
end
Also aliased as: match_xpath
match_selector(name, attributes = {}, &block) click to toggle source
Alias for: have_selector
match_xpath(expected, options = {}, &block) click to toggle source
Alias for: have_xpath

[Validate]

Generated with the Darkfish Rdoc Generator 2.