Module: XmlFixtureHelper

Defined in:
lib/xml_fixture_helper.rb

Instance Method Summary collapse

Instance Method Details

#assert_xml_equal(first, second) ⇒ Object



11
12
13
14
15
16
# File 'lib/xml_fixture_helper.rb', line 11

def assert_xml_equal(first, second)
  first = get_xml_fixture(first) if first.is_a? Symbol
  assert_block("#{first.to_s} expected but was\n#{second.to_s}") do
    REXML::Document.new(first) == REXML::Document.new(second)
  end
end

#get_xml_fixture(filename) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/xml_fixture_helper.rb', line 2

def get_xml_fixture(filename)
  filename = filename.to_s + '.xml' if filename.is_a? Symbol
  fixture_xml = ''
  File.open(File.join( xml_fixture_path, filename )) do |f|
    fixture_xml = f.read
  end
  return ERB.new(fixture_xml).result
end