summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/worksheet/tc_data_bar.rb
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-04-13 13:13:34 +0200
committerGeremia Taglialatela <[email protected]>2023-05-03 16:05:17 +0200
commit350f7ae9a04f3d39c099cc54f7c04bf31f385d96 (patch)
treee84af2a70d3b18a0b94c784338faf48215c9c8a8 /test/workbook/worksheet/tc_data_bar.rb
parente81036b76e734ab03fac31faafb9732f6b3b2928 (diff)
downloadcaxlsx-350f7ae9a04f3d39c099cc54f7c04bf31f385d96.tar.gz
caxlsx-350f7ae9a04f3d39c099cc54f7c04bf31f385d96.zip
Add RuboCop Minitest
Diffstat (limited to 'test/workbook/worksheet/tc_data_bar.rb')
-rw-r--r--test/workbook/worksheet/tc_data_bar.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/test/workbook/worksheet/tc_data_bar.rb b/test/workbook/worksheet/tc_data_bar.rb
index aa39c48b..ccb31d40 100644
--- a/test/workbook/worksheet/tc_data_bar.rb
+++ b/test/workbook/worksheet/tc_data_bar.rb
@@ -6,13 +6,14 @@ class TestDataBar < Test::Unit::TestCase
end
def test_defaults
- assert_equal @data_bar.minLength, 10
- assert_equal @data_bar.maxLength, 90
- assert_equal @data_bar.showValue, true
+ assert_equal(10, @data_bar.minLength)
+ assert_equal(90, @data_bar.maxLength)
+ assert(@data_bar.showValue)
end
def test_override_default_cfvos
data_bar = Axlsx::DataBar.new({ :color => 'FF00FF00' }, { :type => :min, :val => "20" })
+
assert_equal("20", data_bar.value_objects.first.val)
assert_equal("0", data_bar.value_objects.last.val)
end
@@ -20,25 +21,26 @@ class TestDataBar < Test::Unit::TestCase
def test_minLength
assert_raise(ArgumentError) { @data_bar.minLength = :invalid_type }
assert_nothing_raised { @data_bar.minLength = 0 }
- assert_equal(@data_bar.minLength, 0)
+ assert_equal(0, @data_bar.minLength)
end
def test_maxLength
assert_raise(ArgumentError) { @data_bar.maxLength = :invalid_type }
assert_nothing_raised { @data_bar.maxLength = 0 }
- assert_equal(@data_bar.maxLength, 0)
+ assert_equal(0, @data_bar.maxLength)
end
def test_showValue
assert_raise(ArgumentError) { @data_bar.showValue = :invalid_type }
assert_nothing_raised { @data_bar.showValue = false }
- assert_equal(@data_bar.showValue, false)
+ refute(@data_bar.showValue)
end
def test_to_xml_string
doc = Nokogiri::XML.parse(@data_bar.to_xml_string)
- assert_equal(doc.xpath(".//dataBar[@minLength=10][@maxLength=90][@showValue=1]").size, 1)
- assert_equal(doc.xpath(".//dataBar//cfvo").size, 2)
- assert_equal(doc.xpath(".//dataBar//color").size, 1)
+
+ assert_equal(1, doc.xpath(".//dataBar[@minLength=10][@maxLength=90][@showValue=1]").size)
+ assert_equal(2, doc.xpath(".//dataBar//cfvo").size)
+ assert_equal(1, doc.xpath(".//dataBar//color").size)
end
end