Sha256: 18a05057befddb75828fc788c97c0c6751b770ad01ccd248f04fe1543645c1dc

Contents?: true

Size: 631 Bytes

Versions: 28

Compression:

Stored size: 631 Bytes

Contents

module Sablon
  module Test
    module Assertions
      def assert_docx_equal(expected_path, actual_path)
        if get_document_xml(expected_path) != get_document_xml(actual_path)
          msg = <<-error
The generated document does not match the sample. Please investigate.

If the generated document is correct, the sample needs to be updated:
\t cp #{actual_path} #{expected_path}
      error
          fail msg
        end
      end

      def get_document_xml(path)
        document_xml_entry = Zip::File.open(path).get_entry("word/document.xml")
        document_xml_entry.get_input_stream.read
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
sablon-0.0.9 lib/sablon/test/assertions.rb
sablon-0.0.8 lib/sablon/test/assertions.rb
sablon-0.0.7 lib/sablon/test/assertions.rb
sablon-0.0.6 lib/sablon/test/assertions.rb
sablon-0.0.5 lib/sablon/test/assertions.rb
sablon-0.0.4 lib/sablon/test/assertions.rb
sablon-0.0.3 lib/sablon/test/assertions.rb
sablon-0.0.2 lib/sablon/test/assertions.rb