Class: XmlSpec::Matchers::IncludeXml
- Inherits:
-
Object
- Object
- XmlSpec::Matchers::IncludeXml
- Includes:
- Helpers
- Defined in:
- lib/xml_spec/matchers.rb
Instance Attribute Summary collapse
-
#actual ⇒ Object
readonly
Returns the value of attribute actual.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
Instance Method Summary collapse
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected_xml) ⇒ IncludeXml
constructor
A new instance of IncludeXml.
- #matches?(actual_xml) ⇒ Boolean
Methods included from Helpers
Constructor Details
#initialize(expected_xml) ⇒ IncludeXml
Returns a new instance of IncludeXml.
38 39 40 |
# File 'lib/xml_spec/matchers.rb', line 38 def initialize(expected_xml) @expected_xml = expected_xml end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
36 37 38 |
# File 'lib/xml_spec/matchers.rb', line 36 def actual @actual end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
36 37 38 |
# File 'lib/xml_spec/matchers.rb', line 36 def expected @expected end |
Instance Method Details
#failure_message_for_should ⇒ Object
47 48 49 |
# File 'lib/xml_spec/matchers.rb', line 47 def "the xml:\n#{@actual}\nshould match xml structure:\n#{@expected}" end |
#failure_message_for_should_not ⇒ Object
51 52 53 |
# File 'lib/xml_spec/matchers.rb', line 51 def "the xml:\n#{@actual}\nshould not match xml structure:\n#{@expected}\nbut it does" end |
#matches?(actual_xml) ⇒ Boolean
42 43 44 45 |
# File 'lib/xml_spec/matchers.rb', line 42 def matches?(actual_xml) @actual, @expected = parse_xml(actual_xml, @expected_xml) @actual.match?(expected, true) end |