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/drawing/tc_bar_3D_chart.rb | |
| parent | e81036b76e734ab03fac31faafb9732f6b3b2928 (diff) | |
| download | caxlsx-350f7ae9a04f3d39c099cc54f7c04bf31f385d96.tar.gz caxlsx-350f7ae9a04f3d39c099cc54f7c04bf31f385d96.zip | |
Add RuboCop Minitest
Diffstat (limited to 'test/drawing/tc_bar_3D_chart.rb')
| -rw-r--r-- | test/drawing/tc_bar_3D_chart.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/test/drawing/tc_bar_3D_chart.rb b/test/drawing/tc_bar_3D_chart.rb index 178ee65a..a2e245f6 100644 --- a/test/drawing/tc_bar_3D_chart.rb +++ b/test/drawing/tc_bar_3D_chart.rb @@ -11,9 +11,9 @@ class TestBar3DChart < Test::Unit::TestCase def teardown; end def test_initialization - assert_equal(@chart.grouping, :clustered, "grouping defualt incorrect") + assert_equal(:clustered, @chart.grouping, "grouping defualt incorrect") assert_equal(@chart.series_type, Axlsx::BarSeries, "series type incorrect") - assert_equal(@chart.bar_dir, :bar, " bar direction incorrect") + assert_equal(:bar, @chart.bar_dir, " bar direction incorrect") assert(@chart.cat_axis.is_a?(Axlsx::CatAxis), "category axis not created") assert(@chart.val_axis.is_a?(Axlsx::ValAxis), "value access not created") end @@ -21,33 +21,33 @@ class TestBar3DChart < Test::Unit::TestCase def test_bar_direction assert_raise(ArgumentError, "require valid bar direction") { @chart.bar_dir = :left } assert_nothing_raised("allow valid bar direction") { @chart.bar_dir = :col } - assert(@chart.bar_dir == :col) + assert_equal(:col, @chart.bar_dir) end def test_grouping assert_raise(ArgumentError, "require valid grouping") { @chart.grouping = :inverted } assert_nothing_raised("allow valid grouping") { @chart.grouping = :standard } - assert(@chart.grouping == :standard) + assert_equal(:standard, @chart.grouping) end def test_gap_width assert_raise(ArgumentError, "require valid gap width") { @chart.gap_width = -1 } assert_raise(ArgumentError, "require valid gap width") { @chart.gap_width = 501 } assert_nothing_raised("allow valid gapWidth") { @chart.gap_width = 200 } - assert_equal(@chart.gap_width, 200, 'gap width is incorrect') + assert_equal(200, @chart.gap_width, 'gap width is incorrect') end def test_gap_depth assert_raise(ArgumentError, "require valid gap_depth") { @chart.gap_depth = -1 } assert_raise(ArgumentError, "require valid gap_depth") { @chart.gap_depth = 501 } assert_nothing_raised("allow valid gap_depth") { @chart.gap_depth = 200 } - assert_equal(@chart.gap_depth, 200, 'gap depth is incorrect') + assert_equal(200, @chart.gap_depth, 'gap depth is incorrect') end def test_shape assert_raise(ArgumentError, "require valid shape") { @chart.shape = :star } assert_nothing_raised("allow valid shape") { @chart.shape = :cone } - assert(@chart.shape == :cone) + assert_equal(:cone, @chart.shape) end def test_to_xml_string @@ -58,13 +58,15 @@ class TestBar3DChart < 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_has_axes_in_correct_order str = @chart.to_xml_string cat_axis_position = str.index(@chart.axes[:cat_axis].id.to_s) val_axis_position = str.index(@chart.axes[:val_axis].id.to_s) + assert(cat_axis_position < val_axis_position, "cat_axis must occur earlier than val_axis in the XML") end @@ -72,6 +74,7 @@ class TestBar3DChart < Test::Unit::TestCase gap_depth_value = rand(0..500) @chart.gap_depth = gap_depth_value doc = Nokogiri::XML(@chart.to_xml_string) + assert_equal(doc.xpath("//c:bar3DChart/c:gapDepth").first.attribute('val').value, gap_depth_value.to_s) end @@ -79,6 +82,7 @@ class TestBar3DChart < Test::Unit::TestCase gap_width_value = rand(0..500) @chart.gap_width = gap_width_value doc = Nokogiri::XML(@chart.to_xml_string) + assert_equal(doc.xpath("//c:bar3DChart/c:gapWidth").first.attribute('val').value, gap_width_value.to_s) end end |
