Sha256: ca66e0c8711b606587bd5de7dc34e56494e1698ada389fc788fbb86cb996f32d

Contents?: true

Size: 946 Bytes

Versions: 3

Compression:

Stored size: 946 Bytes

Contents

require 'test_helper'

class SerializeTest < MiniTest::Test

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

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

  # Backwards compatibility with pre 0.1.5 (serialize)
  def test_works_with_apply_styles_serialize
    filename = 'with_apply_styles_serialize'
    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
    serialize(filename)
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

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