test/helper.rb in write_xlsx-0.75.0 vs test/helper.rb in write_xlsx-0.76.0

- old
+ new

@@ -66,11 +66,12 @@ ret.split(/\n/) end def entrys(xlsx) result = [] - Zip::File.foreach(xlsx) { |entry| result << entry } + ruby_19 { Zip::File.foreach(xlsx) { |entry| result << entry } } || + ruby_18 { Zip::ZipFile.foreach(xlsx) { |entry| result << entry } } result end def compare_xlsx_for_regression(exp_filename, got_filename, ignore_members = nil, ignore_elements = nil) compare_xlsx(exp_filename, got_filename, ignore_members, ignore_elements, true) @@ -98,14 +99,16 @@ begin got_str = got_members[i].get_input_stream.read got_xml_str = got_str.gsub(%r!(\S)/>!, '\1 />') # exp_xml_str = exp_members[i].get_input_stream.read.gsub(%r!(\S)/>!, '\1 />') exp_str = exp_members[i].get_input_stream.read - exp_str.force_encoding("ASCII-8BIT") if got_str.encoding == Encoding::ASCII_8BIT + ruby_19 do + exp_str.force_encoding("ASCII-8BIT") if got_str.encoding == Encoding::ASCII_8BIT + end exp_xml_str = exp_str.gsub(%r!(\S)/>!, '\1 />') rescue - p got_str.encoding - p exp_str.encoding + p ruby_19 { got_str.encoding } || ruby_18 { got_str } + p ruby_19 { exp_str.encoding } || ruby_18 { exp_str } end # Remove dates and user specific data from the core.xml data. if exp_members[i].name == 'docProps/core.xml' if regression exp_xml_str = exp_xml_str.gsub(/ ?John/, '').gsub(/\d\d\d\d-\d\d-\d\dT\d\d\:\d\d:\d\dZ/,'')