test/test_roo_excel.rb in roo-xls-1.0.0 vs test/test_roo_excel.rb in roo-xls-1.1.0

- old
+ new

@@ -1,7 +1,8 @@ # -- encoding : utf-8 -- require 'test_helper' +require 'stringio' class TestRooExcel < MiniTest::Test def with_spreadsheet(name) yield ::Roo::Spreadsheet.open(File.join(TESTDIR, "#{name}.xls")) end @@ -1032,11 +1033,11 @@ while i < s.length && '01234567890'.include?(s[i, 1]) number = number * 10 + s[i, 1].to_i i += 1 end if letter == '' || number == 0 - fail ArgumentError + raise ArgumentError end [letter, number] end # def sum(s,expression) @@ -1088,6 +1089,14 @@ # } # excel.default_sheet = excel.sheets.first # assert_equal 'ist "e" im Nenner von H(s)', excel.cell('b', 5) # end # end + + def test_excel_via_stringio + io = StringIO.new( + File.read(File.join(TESTDIR, 'simple_spreadsheet.xls'))) + spreadsheet = ::Roo::Spreadsheet.open(io, extension: '.xls') + spreadsheet.default_sheet = spreadsheet.sheets.first + assert_equal 'Task 1', spreadsheet.cell('f', 4) + end end