Sha256: e2c0e6793df628df007b07ed543b2f4971874c91407d6e220ea4c10299db3a6b
Contents?: true
Size: 1.1 KB
Versions: 1
Compression:
Stored size: 1.1 KB
Contents
# frozen_string_literal: true require 'xlsxwriter' require_relative './support/xlsx_comparable' class XlsxWriterTestCaseConfig attr_accessor :ignore_elements, :ignore_files def initialize @ignore_elements = {} @ignore_files = [] end end class XlsxWriterTestCase < Test::Unit::TestCase include XlsxComparable def self.test(name, opts=nil, &block) define_method(:"test_#{name}") do file_path = "tmp/#{name}.xlsx" ref_name = opts && opts.delete(:ref_file_name) || name ref_file_path = "ext/xlsxwriter/libxlsxwriter/test/functional/xlsx_files/#{ref_name}.xlsx" begin tc = XlsxWriterTestCaseConfig.new args = [file_path, opts].compact XlsxWriter::Workbook.open(*args) do |wb| instance_exec(wb, tc, &block) end assert_xlsx_equal file_path, ref_file_path, tc.ignore_files, tc.ignore_elements ensure File.delete file_path if File.exist? file_path end end end def image_path(path) File.expand_path(File.join('../../ext/xlsxwriter/libxlsxwriter/test/functional/src/images', path), __FILE__) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xlsxwriter-0.2.0.pre | test/xlsx-func-testcase.rb |