Class: XmlSpec::Matchers::BeXmlEql
- Inherits:
-
Object
- Object
- XmlSpec::Matchers::BeXmlEql
- 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
- #diffable? ⇒ Boolean
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected_xml) ⇒ BeXmlEql
constructor
A new instance of BeXmlEql.
- #matches?(actual_xml) ⇒ Boolean
Methods included from Helpers
Constructor Details
#initialize(expected_xml) ⇒ BeXmlEql
Returns a new instance of BeXmlEql.
15 16 17 |
# File 'lib/xml_spec/matchers.rb', line 15 def initialize(expected_xml) @expected_xml = expected_xml end |
Instance Attribute Details
#actual ⇒ Object (readonly)
Returns the value of attribute actual.
9 10 11 |
# File 'lib/xml_spec/matchers.rb', line 9 def actual @actual end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected.
9 10 11 |
# File 'lib/xml_spec/matchers.rb', line 9 def expected @expected end |
Instance Method Details
#diffable? ⇒ Boolean
11 12 13 |
# File 'lib/xml_spec/matchers.rb', line 11 def diffable? true end |
#failure_message_for_should ⇒ Object
24 25 26 |
# File 'lib/xml_spec/matchers.rb', line 24 def "the xml:\n#{@actual}\nshould exactly match xml:\n#{@expected}" end |
#failure_message_for_should_not ⇒ Object
28 29 30 |
# File 'lib/xml_spec/matchers.rb', line 28 def "the xml:\n#{@actual}\nshould not exactly match xml:\n#{@expected}\nbut it does" end |
#matches?(actual_xml) ⇒ Boolean
19 20 21 22 |
# File 'lib/xml_spec/matchers.rb', line 19 def matches?(actual_xml) @actual, @expected = parse_xml(actual_xml, @expected_xml) @actual.match?(@expected, true) && @expected.match?(@actual, true) end |