Module Webrat::Matchers

  1. lib/webrat/core/matchers/have_content.rb (view online)
  2. lib/webrat/core/matchers/have_selector.rb (view online)
  3. lib/webrat/core/matchers/have_xpath.rb (view online)
  4. show all

Public instance methods

assert_contain (content)

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

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

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

[show source]
# 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)
[show source]
# File lib/webrat/core/matchers/have_xpath.rb, line 141
    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)

Asserts that the body of the response contains the supplied selector

[show source]
# 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)
[show source]
# File lib/webrat/core/matchers/have_xpath.rb, line 136
    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)

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

[show source]
# File lib/webrat/core/matchers/have_content.rb, line 67
    def assert_not_contain(content)
      hc = HasContent.new(content)
      assert !hc.matches?(response_body), hc.negative_failure_message
    end
contain (content)

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

[show source]
# File lib/webrat/core/matchers/have_content.rb, line 54
    def contain(content)
      HasContent.new(content)
    end
have_selector (name, attributes = {}, &block)

Matches HTML content against a CSS 3 selector.

Parameters

expected:The CSS selector to look for.

Returns

HaveSelector:A new have selector matcher.
[show source]
# File lib/webrat/core/matchers/have_selector.rb, line 53
    def have_selector(name, attributes = {}, &block)
      HaveSelector.new(name, attributes, &block)
    end
have_xpath (expected, options = {}, &block)

Matches HTML content against an XPath query

Parameters

expected:The XPath query to look for.

Returns

HaveXpath:A new have xpath matcher.
[show source]
# File lib/webrat/core/matchers/have_xpath.rb, line 131
    def have_xpath(expected, options = {}, &block)
      HaveXpath.new(expected, options, &block)
    end
match_selector (name, attributes = {}, &block)

Alias for have_selector

match_xpath (expected, options = {}, &block)

Alias for have_xpath