Sha256: f21b0e9ca4fc012fb1a9e2a5debb867e869c208efbfaa2e7071848133d63bca4

Contents?: true

Size: 754 Bytes

Versions: 2

Compression:

Stored size: 754 Bytes

Contents

require_relative 'test_helper'

describe "FastExcel validations" do

  it "should raise error when duplicate sheet name" do
    workbook = FastExcel.open(constant_memory: true)

    workbook.add_worksheet("Payments Report")
    error = assert_raises do
      workbook.add_worksheet("Payments Report")
    end

    assert_equal(ArgumentError, error.class)
    assert_equal("Worksheet name 'Payments Report' is already in use", error.message)
  end

  it "should not raise error when worksheet name is empty string" do
    workbook = FastExcel.open(constant_memory: true)

    ws1 = workbook.add_worksheet("")
    ws2 = workbook.add_worksheet("")
    ws2.write_value(0, 2, "aaa")

    assert_equal("", ws1[:name])
    assert_equal("", ws2[:name])
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fast_excel-0.2.6 test/validations_test.rb
fast_excel-0.2.5 test/validations_test.rb