Sha256: ae3bff4177c3b5dcdfbfa833b6cbe989a1193bfe9edb0ea7d7ce3067cf4198f1

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# encoding: utf-8

require 'minitest/autorun'
require 'tmpdir'
require 'jruby_excelcom'

describe 'ExcelConnection' do

  $con ||= begin
    e = ExcelConnection::connect
    e.display_alerts = false
    e
  end
  $wb ||= $con.workbook("#{File.dirname(File.expand_path(__FILE__))}/../resources/test.xlsx")

  Minitest::Unit.after_tests {
    $wb.close unless $wb.nil?; $wb = nil
    $con.quit unless $con.nil?; $con = nil
  }

  it '::connect' do
    $con.wont_be_nil
    ExcelConnection::connect(false) do |con|
      con.version.is_a? String
    end
  end

  it '#version' do
    $con.version.is_a? String
  end

  it '#workbook' do
    $wb.wont_be_nil
    $con.workbook("#{File.dirname(File.expand_path(__FILE__))}/../resources/test2.xlsx") { |wb|
      wb.name.is_a? String
    }
  end

  it '#new_workbook' do
    path = "#{Dir.tmpdir}/newwb.xlsx"
    $con.new_workbook(path) { |wb|
      wb.name.must_equal "newwb.xlsx"
    }
    File.exists?(path).must_equal true
    File.delete path
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jruby_excelcom-0.0.5-java test/unit/excel_connection_spec.rb
jruby_excelcom-0.0.4-java test/unit/excel_connection_spec.rb