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

Instance Method Details

#assert_contain(content) ⇒ Object

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



65
66
67
68
# File 'lib/webrat/selenium/matchers/have_content.rb', line 65

def assert_contain(content)
  hc = HasContent.new(content)
  assert hc.matches?(response), hc.failure_message
end

#assert_have_no_selector(expected) ⇒ Object

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



51
52
53
54
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 51

def assert_have_no_selector(expected)
  hs = HaveSelector.new(expected)
  assert !hs.matches?(response), hs.negative_failure_message
end

#assert_have_no_tag(name, attributes = {}) ⇒ Object

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



65
66
67
68
# File 'lib/webrat/selenium/matchers/have_tag.rb', line 65

def assert_have_no_tag(name, attributes = {})
  ht = HaveTag.new([name, attributes])
  assert !ht.matches?(response), ht.negative_failure_message
end

#assert_have_no_xpath(expected) ⇒ Object



47
48
49
50
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 47

def assert_have_no_xpath(expected)
  hs = HaveXpath.new(expected)
  assert !hs.matches?(response), hs.negative_failure_message
end

#assert_have_selector(expected) ⇒ Object

Asserts that the body of the response contains the supplied selector



44
45
46
47
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 44

def assert_have_selector(expected)
  hs = HaveSelector.new(expected)
  assert hs.matches?(response), hs.failure_message
end

#assert_have_tag(name, attributes = {}) ⇒ Object

Asserts that the body of the response contains the supplied tag with the associated selectors



58
59
60
61
# File 'lib/webrat/selenium/matchers/have_tag.rb', line 58

def assert_have_tag(name, attributes = {})
  ht = HaveTag.new([name, attributes])
  assert ht.matches?(response), ht.failure_message
end

#assert_have_xpath(expected) ⇒ Object



42
43
44
45
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 42

def assert_have_xpath(expected)
  hs = HaveXpath.new(expected)
  assert hs.matches?(response), hs.failure_message
end

#assert_not_contain(content) ⇒ Object

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



72
73
74
75
# File 'lib/webrat/selenium/matchers/have_content.rb', line 72

def assert_not_contain(content)
  hc = HasContent.new(content)
  assert !hc.matches?(response), hc.negative_failure_message
end

#contain(content) ⇒ Object

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



59
60
61
# File 'lib/webrat/selenium/matchers/have_content.rb', line 59

def contain(content)
  HasContent.new(content)
end

#have_selector(content) ⇒ Object



38
39
40
# File 'lib/webrat/selenium/matchers/have_selector.rb', line 38

def have_selector(content)
  HaveSelector.new(content)
end

#have_tag(name, attributes = {}, &block) ⇒ Object Also known as: match_tag



50
51
52
# File 'lib/webrat/selenium/matchers/have_tag.rb', line 50

def have_tag(name, attributes = {}, &block)
  HaveTag.new([name, attributes], &block)
end

#have_xpath(xpath) ⇒ Object



38
39
40
# File 'lib/webrat/selenium/matchers/have_xpath.rb', line 38

def have_xpath(xpath)
  HaveXpath.new(xpath)
end