test/test_helper.rb in fast_excel-0.2.3 vs test/test_helper.rb in fast_excel-0.2.5
- old
+ new
@@ -1,8 +1,9 @@
require 'bundler/setup'
require 'minitest/autorun'
require "minitest/reporters"
+require 'pp'
##Encoding.default_external = Encoding::UTF_8
##Encoding.default_internal = Encoding::UTF_8
require 'date'
@@ -38,15 +39,17 @@
excel = parse_xlsx(file_path)
sheet = excel.sheet(0)
rows = []
- 1.upto(sheet.last_row) do |row_number|
- row = 1.upto(sheet.last_column).map do |col|
- sheet.cell(row_number, col)
- end
+ if sheet.last_row
+ 1.upto(sheet.last_row) do |row_number|
+ row = 1.upto(sheet.last_column).map do |col|
+ sheet.cell(row_number, col)
+ end
- rows << row
+ rows << row
+ end
end
return rows
end