diff options
| author | Geremia Taglialatela <[email protected]> | 2023-04-13 17:16:49 +0200 |
|---|---|---|
| committer | Geremia Taglialatela <[email protected]> | 2023-05-03 16:05:38 +0200 |
| commit | 6e215fa74d047a2d281a5b1caa891579198f7313 (patch) | |
| tree | db4b7e6e6089475c01e4880744202d604e2e8902 /test | |
| parent | f2e55f053bac8bc2a97f2208237608e20eb1eeaa (diff) | |
| download | caxlsx-6e215fa74d047a2d281a5b1caa891579198f7313.tar.gz caxlsx-6e215fa74d047a2d281a5b1caa891579198f7313.zip | |
Fix non-production Style/NumericLiterals offenses
Diffstat (limited to 'test')
| -rw-r--r-- | test/drawing/tc_axis.rb | 2 | ||||
| -rw-r--r-- | test/drawing/tc_one_cell_anchor.rb | 4 | ||||
| -rw-r--r-- | test/drawing/tc_scatter_series.rb | 8 | ||||
| -rwxr-xr-x | test/profile.rb | 2 | ||||
| -rw-r--r-- | test/tc_package.rb | 4 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_col.rb | 2 | ||||
| -rw-r--r-- | test/workbook/worksheet/tc_date_time_converter.rb | 16 |
7 files changed, 19 insertions, 19 deletions
diff --git a/test/drawing/tc_axis.rb b/test/drawing/tc_axis.rb index 198a4cf3..d62f4fbd 100644 --- a/test/drawing/tc_axis.rb +++ b/test/drawing/tc_axis.rb @@ -49,7 +49,7 @@ class TestAxis < Test::Unit::TestCase assert_raise(ArgumentError, "requires valid angle") { @axis.label_rotation = 91 } assert_raise(ArgumentError, "requires valid angle") { @axis.label_rotation = -91 } assert_nothing_raised("accepts valid angle") { @axis.label_rotation = 45 } - assert_equal(45 * 60000, @axis.label_rotation) + assert_equal(45 * 60_000, @axis.label_rotation) end def test_tick_label_position diff --git a/test/drawing/tc_one_cell_anchor.rb b/test/drawing/tc_one_cell_anchor.rb index 0f39d103..1c28ef52 100644 --- a/test/drawing/tc_one_cell_anchor.rb +++ b/test/drawing/tc_one_cell_anchor.rb @@ -45,8 +45,8 @@ class TestOneCellAnchor < Test::Unit::TestCase def test_ext ext = @anchor.send(:ext) - assert_equal(ext[:cx], (@anchor.width * 914400 / 96)) - assert_equal(ext[:cy], (@anchor.height * 914400 / 96)) + assert_equal(ext[:cx], (@anchor.width * 914_400 / 96)) + assert_equal(ext[:cy], (@anchor.height * 914_400 / 96)) end def test_options diff --git a/test/drawing/tc_scatter_series.rb b/test/drawing/tc_scatter_series.rb index cc5a4d2e..f9f5aad0 100644 --- a/test/drawing/tc_scatter_series.rb +++ b/test/drawing/tc_scatter_series.rb @@ -43,17 +43,17 @@ class TestScatterSeries < Test::Unit::TestCase def test_ln_width @chart = @ws.add_chart Axlsx::ScatterChart, :title => "ln width", :scatter_style => :line @series = @chart.add_series :xData => [1, 2, 4], :yData => [1, 3, 9], :title => "ln_width" - @series.ln_width = 12700 + @series.ln_width = 12_700 - assert_equal(12700, @series.ln_width, 'line width assigment is allowed') + assert_equal(12_700, @series.ln_width, 'line width assigment is allowed') end def test_to_xml_string @chart.scatter_style = :line - @series.ln_width = 12700 + @series.ln_width = 12_700 doc = Nokogiri::XML(@chart.to_xml_string) - assert_equal(12700, @series.ln_width) + assert_equal(12_700, @series.ln_width) assert_equal(4, doc.xpath("//a:srgbClr[@val='#{@series.color}']").size) assert_equal(1, doc.xpath("//a:ln[@w='#{@series.ln_width}']").length) end diff --git a/test/profile.rb b/test/profile.rb index a81c813b..7b671831 100755 --- a/test/profile.rb +++ b/test/profile.rb @@ -13,7 +13,7 @@ input = (32..126).to_a.pack('U*').chars.to_a profile = RubyProf.profile do p = Axlsx::Package.new p.workbook.add_worksheet do |sheet| - 10000.times do + 10_000.times do sheet << row end end diff --git a/test/tc_package.rb b/test/tc_package.rb index 062c9c88..523e0e54 100644 --- a/test/tc_package.rb +++ b/test/tc_package.rb @@ -28,7 +28,7 @@ class TestPackage < Test::Unit::TestCase vs.pane do |p| p.active_pane = :top_right p.state = :split - p.x_split = 11080 + p.x_split = 11_080 p.y_split = 5000 p.top_left_cell = 'C44' end @@ -327,7 +327,7 @@ class TestPackage < Test::Unit::TestCase assert(stream.is_a?(StringIO)) # this is just a roundabout guess for a package as it is build now # in testing. - assert(stream.size > 80000) + assert(stream.size > 80_000) # Stream (of zipped contents) should have appropriate default encoding assert_predicate stream.string, :valid_encoding? assert_equal(stream.external_encoding, Encoding::ASCII_8BIT) diff --git a/test/workbook/worksheet/tc_col.rb b/test/workbook/worksheet/tc_col.rb index f4258602..d34b84ec 100644 --- a/test/workbook/worksheet/tc_col.rb +++ b/test/workbook/worksheet/tc_col.rb @@ -47,7 +47,7 @@ class TestCol < Test::Unit::TestCase end def test_widthOverLimit - @col.width = 31337 + @col.width = 31_337 assert_equal(255, @col.width, 'width is set to maximum allowed value') end diff --git a/test/workbook/worksheet/tc_date_time_converter.rb b/test/workbook/worksheet/tc_date_time_converter.rb index ed914441..669dee06 100644 --- a/test/workbook/worksheet/tc_date_time_converter.rb +++ b/test/workbook/worksheet/tc_date_time_converter.rb @@ -11,8 +11,8 @@ class TestDateTimeConverter < Test::Unit::TestCase "1893-08-05" => -2338.0, "1900-01-01" => 2.0, "1910-02-03" => 3687.0, - "2006-02-01" => 38749.0, - "9999-12-31" => 2958465.0 + "2006-02-01" => 38_749.0, + "9999-12-31" => 2_958_465.0 }.each do |date_string, expected| serial = Axlsx::DateTimeConverter::date_to_serial Date.parse(date_string) @@ -26,8 +26,8 @@ class TestDateTimeConverter < Test::Unit::TestCase "1893-08-05" => -3800.0, "1904-01-01" => 0.0, "1910-02-03" => 2225.0, - "2006-02-01" => 37287.0, - "9999-12-31" => 2957003.0 + "2006-02-01" => 37_287.0, + "9999-12-31" => 2_957_003.0 }.each do |date_string, expected| serial = Axlsx::DateTimeConverter::date_to_serial Date.parse(date_string) @@ -42,7 +42,7 @@ class TestDateTimeConverter < Test::Unit::TestCase "1899-12-28T18:00:00Z" => -1.25, "1910-02-03T10:05:54Z" => 3687.4207639, "1900-01-01T12:00:00Z" => 2.5, # wrongly indicated as 1.5 in the spec! - "9999-12-31T23:59:59Z" => 2958465.9999884 + "9999-12-31T23:59:59Z" => 2_958_465.9999884 }.each do |time_string, expected| serial = Axlsx::DateTimeConverter::time_to_serial Time.parse(time_string) @@ -57,7 +57,7 @@ class TestDateTimeConverter < Test::Unit::TestCase "1893-08-05T00:00:01Z" => -3799.999989, "1910-02-03T10:05:54Z" => 2225.4207639, "1904-01-01T12:00:00Z" => 0.5000000, - "9999-12-31T23:59:59Z" => 2957003.9999884 + "9999-12-31T23:59:59Z" => 2_957_003.9999884 }.each do |time_string, expected| serial = Axlsx::DateTimeConverter::time_to_serial Time.parse(time_string) @@ -70,9 +70,9 @@ class TestDateTimeConverter < Test::Unit::TestCase local = Time.parse "2012-01-01 09:00:00 +0900" assert_equal local, utc - assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - (local.utc_offset.to_f / 86400), Axlsx::DateTimeConverter::time_to_serial(utc) + assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - (local.utc_offset.to_f / 86_400), Axlsx::DateTimeConverter::time_to_serial(utc) Axlsx::Workbook.date1904 = true - assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - (local.utc_offset.to_f / 86400), Axlsx::DateTimeConverter::time_to_serial(utc) + assert_equal Axlsx::DateTimeConverter::time_to_serial(local) - (local.utc_offset.to_f / 86_400), Axlsx::DateTimeConverter::time_to_serial(utc) end end |
