Sha256: efd8d57d921f503b5f18cceb626405039997cf189844d3dfb6c94bf6a60522c0

Contents?: true

Size: 715 Bytes

Versions: 1

Compression:

Stored size: 715 Bytes

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
excel-esv-0.0.4 spec/esv_spec.rb