Class: TestXml::Spec::MatchXml

Inherits:
Object
  • Object
show all
Includes:
Matchers
Defined in:
lib/test_xml/spec.rb

Instance Method Summary collapse

Methods included from Matchers

#match_xml?

Constructor Details

#initialize(expected, compare_values = false) ⇒ MatchXml

Returns a new instance of MatchXml.



6
7
8
9
# File 'lib/test_xml/spec.rb', line 6

def initialize(expected, compare_values = false)
  @expected = expected
  @compare_values = compare_values
end

Instance Method Details

#failure_message_for_shouldObject



16
17
18
# File 'lib/test_xml/spec.rb', line 16

def failure_message_for_should
  "expected\n#{@actual} to match#{structure_message}\n#{@expected}"
end

#failure_message_for_should_notObject



20
21
22
# File 'lib/test_xml/spec.rb', line 20

def failure_message_for_should_not
  "expected\n#{@actual} not to match#{structure_message}\n#{@expected}"
end

#matches?(actual) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
14
# File 'lib/test_xml/spec.rb', line 11

def matches?(actual)
  @actual = actual
  match_xml?(@actual, @expected, @compare_values)
end