Sha256: 1f24af0d5a011bab2d02d51b77cbcefa761cfa900503ecc66725d9d9615d3af3

Contents?: true

Size: 833 Bytes

Versions: 5

Compression:

Stored size: 833 Bytes

Contents

# -*- coding: utf-8 -*-
require 'rubygems'
require 'test/unit'

$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'writeexcel'

class Test::Unit::TestCase
  ###############################################################################
  #
  # Unpack the binary data into a format suitable for printing in tests.
  #
  def unpack_record(data)
    data.unpack('C*').map! {|c| sprintf("%02X", c) }.join(' ')
  end

  # expected : existing file path
  # target   : io (ex) string io object where stored data.
  def compare_file(expected, target)
    # target is StringIO object.
    assert_equal(
      File.binread(expected),
      target.string.force_encoding('BINARY'),
      "#{File.basename(expected)} doesn't match."
    )
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
writeexcel-0.5.0 test/helper.rb
writeexcel-0.4.3 test/helper.rb
writeexcel-0.4.2 test/helper.rb
writeexcel-0.4.1 test/helper.rb
writeexcel-0.4.0 test/helper.rb