Sha256: a47c7884322a923d2bc55ce3c9f262f163a2a312ec9c46b682de2c39cec97efa

Contents?: true

Size: 945 Bytes

Versions: 3

Compression:

Stored size: 945 Bytes

Contents

require 'test_helper'

class ToStreamTest < MiniTest::Test

  def setup
    @axlsx = Axlsx::Package.new
    @workbook = @axlsx.workbook
  end

  def test_works_without_apply_styles_to_stream
    filename = 'without_apply_styles_to_stream'
    assert_nil @workbook.styles_applied
    @workbook.add_worksheet do |sheet|
      sheet.add_row ['A1', 'B1']
      sheet.add_style 'A1:B1', b: true
    end
    to_stream(filename)
    assert_equal 1, @workbook.styles.style_index.count
  end

  # Backwards compatibility with pre 0.1.5 (to_stream)
  def test_works_with_apply_styles_to_stream
    filename = 'with_apply_styles_to_stream'
    assert_nil @workbook.styles_applied
    @workbook.add_worksheet do |sheet|
      sheet.add_row ['A1', 'B1']
      sheet.add_style 'A1:B1', b: true
    end
    @workbook.apply_styles # important for backwards compatibility
    assert_equal 1, @workbook.styles.style_index.count
    to_stream(filename)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
axlsx_styler-1.2.0 test/unit/to_stream_test.rb
axlsx_styler-1.1.0 test/unit/to_stream_test.rb
axlsx_styler-1.0.0 test/unit/to_stream_test.rb