Sha256: 996bf332c6dbbfad818cb7ec1eef5a87b31368d6e8d7833bb1b8730584f19147

Contents?: true

Size: 1.13 KB

Versions: 18

Compression:

Stored size: 1.13 KB

Contents

#!/usr/bin/env ruby
# TestWorkbook -- Spreadsheet -- 24.09.2008 -- hwyss@ywesee.com

$: << File.expand_path('../lib', File.dirname(__FILE__))

require 'test/unit'
require 'spreadsheet'
require 'fileutils'
require 'stringio'

module Spreadsheet
  class TestWorkbook < Test::Unit::TestCase
    def setup
      @io = StringIO.new ''
      @book = Workbook.new
    end
    def test_writer__default_excel
      assert_instance_of Excel::Writer::Workbook, @book.writer(@io)
    end
    def test_sheet_count
        @worksheet1 = Excel::Worksheet.new
        @book.add_worksheet @worksheet1
        assert_equal 1, @book.sheet_count
        @worksheet2 = Excel::Worksheet.new
        @book.add_worksheet @worksheet2
        assert_equal 2, @book.sheet_count
    end
    def test_add_format

      assert_equal 1, @book.formats.length # Received a default format

      f1 = Format.new
      @book.add_format f1
      assert_equal 2, @book.formats.length

      f2 = Format.new
      @book.add_format f2
      assert_equal 3, @book.formats.length

      @book.add_format f2
      assert_equal 3, @book.formats.length # Rejected duplicate insertion
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
spreadsheet-0.8.9 test/workbook.rb
spreadsheet-0.8.8 test/workbook.rb
spreadsheet-0.8.7 test/workbook.rb
spreadsheet-0.8.6 test/workbook.rb
spreadsheet-0.8.5 test/workbook.rb
spreadsheet-0.8.4 test/workbook.rb
spreadsheet-0.8.3 test/workbook.rb
spreadsheet-0.8.2 test/workbook.rb
spreadsheet-0.8.1 test/workbook.rb
spreadsheet-0.8.0 test/workbook.rb
spreadsheet-0.7.9 test/workbook.rb
spreadsheet-0.7.8 test/workbook.rb
spreadsheet-0.7.7 test/workbook.rb
spreadsheet-0.7.6 test/workbook.rb
spreadsheet-0.7.5 test/workbook.rb
spreadsheet-0.7.4 test/workbook.rb
spreadsheet-0.7.3 test/workbook.rb
spreadsheet-0.7.2 test/workbook.rb