diff options
| author | Geremia Taglialatela <[email protected]> | 2023-04-13 13:13:34 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-05-03 16:05:17 +0200 |
| commit | 350f7ae9a04f3d39c099cc54f7c04bf31f385d96 (patch) | |
| tree | e84af2a70d3b18a0b94c784338faf48215c9c8a8 /test/workbook/worksheet/tc_table.rb | |
| parent | e81036b76e734ab03fac31faafb9732f6b3b2928 (diff) | |
| download | caxlsx-350f7ae9a04f3d39c099cc54f7c04bf31f385d96.tar.gz caxlsx-350f7ae9a04f3d39c099cc54f7c04bf31f385d96.zip | |
Add RuboCop Minitest
Diffstat (limited to 'test/workbook/worksheet/tc_table.rb')
| -rw-r--r-- | test/workbook/worksheet/tc_table.rb | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/test/workbook/worksheet/tc_table.rb b/test/workbook/worksheet/tc_table.rb index 7a2e5987..0ea0166f 100644 --- a/test/workbook/worksheet/tc_table.rb +++ b/test/workbook/worksheet/tc_table.rb @@ -10,19 +10,21 @@ class TestTable < Test::Unit::TestCase end def test_initialization - assert(@ws.workbook.tables.empty?) - assert(@ws.tables.empty?) + assert_empty(@ws.workbook.tables) + assert_empty(@ws.tables) end def test_table_style_info table = @ws.add_table('A1:D5', :name => 'foo', :style_info => { :show_row_stripes => true, :name => "TableStyleMedium25" }) + assert_equal('TableStyleMedium25', table.table_style_info.name) - assert_equal(true, table.table_style_info.show_row_stripes) + assert(table.table_style_info.show_row_stripes) end def test_add_table name = "test" table = @ws.add_table("A1:D5", :name => name) + assert(table.is_a?(Axlsx::Table), "must create a table") assert_equal(@ws.workbook.tables.last, table, "must be added to workbook table collection") assert_equal(@ws.tables.last, table, "must be added to worksheet table collection") @@ -31,25 +33,30 @@ class TestTable < Test::Unit::TestCase def test_pn @ws.add_table("A1:D5") - assert_equal(@ws.tables.first.pn, "tables/table1.xml") + + assert_equal("tables/table1.xml", @ws.tables.first.pn) end def test_rId table = @ws.add_table("A1:D5") + assert_equal @ws.relationships.for(table).Id, table.rId end def test_index @ws.add_table("A1:D5") + assert_equal(@ws.tables.first.index, @ws.workbook.tables.index(@ws.tables.first)) end def test_relationships - assert(@ws.relationships.empty?) + assert_empty(@ws.relationships) @ws.add_table("A1:D5") - assert_equal(@ws.relationships.size, 1, "adding a table adds a relationship") + + assert_equal(1, @ws.relationships.size, "adding a table adds a relationship") @ws.add_table("F1:J5") - assert_equal(@ws.relationships.size, 2, "adding a table adds a relationship") + + assert_equal(2, @ws.relationships.size, "adding a table adds a relationship") end def test_to_xml_string @@ -61,7 +68,8 @@ class TestTable < Test::Unit::TestCase errors.push error puts error.message end - assert(errors.empty?, "error free validation") + + assert_empty(errors, "error free validation") end def test_to_xml_string_for_special_characters @@ -71,6 +79,7 @@ class TestTable < Test::Unit::TestCase table = @ws.add_table("A1:D5") doc = Nokogiri::XML(table.to_xml_string) errors = doc.errors - assert(errors.empty?, "invalid xml: #{errors.map(&:to_s).join(', ')}") + + assert_empty(errors, "invalid xml: #{errors.map(&:to_s).join(', ')}") end end |
