summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/tc_workbook.rb
diff options
context:
space:
mode:
authorGeremia Taglialatela <[email protected]>2023-05-22 20:13:13 +0200
committerGeremia Taglialatela <[email protected]>2023-05-22 20:13:13 +0200
commit083c4c6d62011cd88966d608b0c6bb736f300a0c (patch)
treeb5ceb9b3a32c4130d84c3075966b4033bf32a118 /test/workbook/tc_workbook.rb
parent6752225bbb8a9eec905ec02a98f1a25a309c404a (diff)
downloadcaxlsx-083c4c6d62011cd88966d608b0c6bb736f300a0c.tar.gz
caxlsx-083c4c6d62011cd88966d608b0c6bb736f300a0c.zip
Use Ruby 1.9 hash syntax (non-production code)
Diffstat (limited to 'test/workbook/tc_workbook.rb')
-rw-r--r--test/workbook/tc_workbook.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/test/workbook/tc_workbook.rb b/test/workbook/tc_workbook.rb
index b1cfdc71..51fe3976 100644
--- a/test/workbook/tc_workbook.rb
+++ b/test/workbook/tc_workbook.rb
@@ -11,7 +11,7 @@ class TestWorkbook < Test::Unit::TestCase
def teardown; end
def test_worksheet_users_xml_space
- sheet = @wb.add_worksheet(:name => 'foo')
+ sheet = @wb.add_worksheet(name: 'foo')
ws_xml = Nokogiri::XML(sheet.to_xml_string)
assert(ws_xml.xpath("//xmlns:worksheet/@xml:space='preserve'"))
@@ -45,16 +45,16 @@ class TestWorkbook < Test::Unit::TestCase
end
def test_sheet_by_name_retrieval
- @wb.add_worksheet(:name => 'foo')
- @wb.add_worksheet(:name => 'bar')
- @wb.add_worksheet(:name => "testin'")
+ @wb.add_worksheet(name: 'foo')
+ @wb.add_worksheet(name: 'bar')
+ @wb.add_worksheet(name: "testin'")
assert_equal('foo', @wb.sheet_by_name('foo').name)
assert_equal("testin&apos;", @wb.sheet_by_name("testin'").name)
end
def test_worksheet_empty_name
- assert_raise(ArgumentError) { @wb.add_worksheet(:name => '') }
+ assert_raise(ArgumentError) { @wb.add_worksheet(name: '') }
end
def test_date1904
@@ -68,7 +68,7 @@ class TestWorkbook < Test::Unit::TestCase
end
def test_add_defined_name
- @wb.add_defined_name 'Sheet1!1:1', :name => '_xlnm.Print_Titles', :hidden => true
+ @wb.add_defined_name 'Sheet1!1:1', name: '_xlnm.Print_Titles', hidden: true
assert_equal(1, @wb.defined_names.size)
end
@@ -87,7 +87,7 @@ class TestWorkbook < Test::Unit::TestCase
def test_add_worksheet
assert_empty(@wb.worksheets, "worbook has no worksheets by default")
- ws = @wb.add_worksheet(:name => "bob")
+ ws = @wb.add_worksheet(name: "bob")
assert_equal(1, @wb.worksheets.size, "add_worksheet adds a worksheet!")
assert_equal(@wb.worksheets.first, ws, "the worksheet returned is the worksheet added")
@@ -95,9 +95,9 @@ class TestWorkbook < Test::Unit::TestCase
end
def test_insert_worksheet
- @wb.add_worksheet(:name => 'A')
- @wb.add_worksheet(:name => 'B')
- ws3 = @wb.insert_worksheet(0, :name => 'C')
+ @wb.add_worksheet(name: 'A')
+ @wb.add_worksheet(name: 'B')
+ ws3 = @wb.insert_worksheet(0, name: 'C')
assert_equal(ws3.name, @wb.worksheets.first.name)
end
@@ -127,15 +127,15 @@ class TestWorkbook < Test::Unit::TestCase
def test_to_xml_reversed
@wb.is_reversed = true
- @wb.add_worksheet(:name => 'first')
- second = @wb.add_worksheet(:name => 'second')
+ @wb.add_worksheet(name: 'first')
+ second = @wb.add_worksheet(name: 'second')
doc = Nokogiri::XML(@wb.to_xml_string)
assert_equal second.name, doc.xpath('//xmlns:workbook/xmlns:sheets/*[1]/@name').to_s
end
def test_range_requires_valid_sheet
- ws = @wb.add_worksheet :name => 'fish'
+ ws = @wb.add_worksheet name: 'fish'
ws.add_row [1, 2, 3]
ws.add_row [4, 5, 6]
assert_raise(ArgumentError, "no sheet name part") { @wb["A1:C2"] }
@@ -178,7 +178,7 @@ class TestWorkbook < Test::Unit::TestCase
end
def test_worksheet_name_is_intact_after_serialized_into_xml
- sheet = @wb.add_worksheet(:name => '_Example')
+ sheet = @wb.add_worksheet(name: '_Example')
wb_xml = Nokogiri::XML(@wb.to_xml_string)
assert_equal sheet.name, wb_xml.xpath('//xmlns:workbook/xmlns:sheets/*[1]/@name').to_s