Class: Xpath::Specs::ContainA

Inherits:
Object
  • Object
show all
Defined in:
lib/xpath/specs/contain_a_matcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(page_part) ⇒ ContainA

Returns a new instance of ContainA.



7
8
9
# File 'lib/xpath/specs/contain_a_matcher.rb', line 7

def initialize(page_part)
  @page_part = page_part
end

Instance Method Details

#descriptionObject



24
25
26
# File 'lib/xpath/specs/contain_a_matcher.rb', line 24

def description
  "expected the page to contain #{@page_part.long_description}"
end

#failure_message_for_shouldObject



16
17
18
# File 'lib/xpath/specs/contain_a_matcher.rb', line 16

def failure_message_for_should
  failure_message_for_should_ex(@page_part)
end

#failure_message_for_should_notObject



20
21
22
# File 'lib/xpath/specs/contain_a_matcher.rb', line 20

def failure_message_for_should_not
  "expected the page not to contain #{@page_part.long_description})"
end

#matches?(page) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/xpath/specs/contain_a_matcher.rb', line 11

def matches?(page)
  @doc = Nokogiri::HTML(body_of(page))
  doc_contains(@page_part)
end