Sha256: 13ffdbeabebe7a2940464b21e5b1c004725fd8c8abfcf749af157c04e148fe06
Contents?: true
Size: 1.11 KB
Versions: 1
Compression:
Stored size: 1.11 KB
Contents
require "esv" describe ESV, ".generate and .parse" do it "works" do data = ESV.generate do |esv| esv << [ "Dogs", "Cats" ] esv << [ 1, 2 ] end output = ESV.parse(data) expect(output).to eq [ [ "Dogs", "Cats" ], [ 1, 2 ], ] end end describe ESV, ".parse" do it "raises if there's more than one worksheet" do expect { ESV.parse(excel_file_with_two_worksheets) }.to raise_error(/Expected 1 worksheet, found 2/) end private def excel_file_with_two_worksheets book = Spreadsheet::Workbook.new book.create_worksheet book.create_worksheet data = "" fake_file = StringIO.new(data) book.write(fake_file) data end end describe ESV, ".generate_file" do before do @file = Tempfile.new("esv") end it "works" do path = @file.path ESV.generate_file(path) do |esv| esv << [ "Dogs", "Cats" ] esv << [ 1, 2 ] end data = File.read(path) output = ESV.parse(data) expect(output).to eq [ [ "Dogs", "Cats" ], [ 1, 2 ], ] end after do @file.close @file.unlink end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
excel-esv-0.0.5 | spec/esv_spec.rb |