summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/tc_workbook.rb
diff options
context:
space:
mode:
authorrandym <[email protected]>2018-02-08 00:14:12 +0900
committerrandym <[email protected]>2018-02-08 00:14:12 +0900
commit747ff93269c518db21c9869b61b1d1470395b502 (patch)
tree16c8d9c416a02fc7ca8bd91e058ea61c72dfc7ce /test/workbook/tc_workbook.rb
parent3f34514ecf53fb4a3401b5336833bbeb439efe2a (diff)
downloadcaxlsx-747ff93269c518db21c9869b61b1d1470395b502.tar.gz
caxlsx-747ff93269c518db21c9869b61b1d1470395b502.zip
chore(coverage) increase coverage and cleanup
Diffstat (limited to 'test/workbook/tc_workbook.rb')
-rw-r--r--test/workbook/tc_workbook.rb19
1 files changed, 17 insertions, 2 deletions
diff --git a/test/workbook/tc_workbook.rb b/test/workbook/tc_workbook.rb
index ab400db1..c2f8ebd6 100644
--- a/test/workbook/tc_workbook.rb
+++ b/test/workbook/tc_workbook.rb
@@ -33,6 +33,12 @@ class TestWorkbook < Test::Unit::TestCase
assert_equal(@wb.use_autowidth, false)
end
+ def test_is_reversed
+ assert_equal(@wb.is_reversed, nil)
+ assert_raise(ArgumentError) {@wb.is_reversed = 0.1}
+ assert_nothing_raised {@wb.is_reversed = true }
+ assert_equal(@wb.use_autowidth, true)
+ end
def test_sheet_by_name_retrieval
@wb.add_worksheet(:name=>'foo')
@@ -98,7 +104,16 @@ class TestWorkbook < Test::Unit::TestCase
end
assert(errors.empty?, "error free validation")
end
- def test_range_requires__valid_sheet
+
+ def test_to_xml_reversed
+ @wb.is_reversed = true
+ @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.add_row [1,2,3]
ws.add_row [4,5,6]
@@ -136,7 +151,7 @@ class TestWorkbook < Test::Unit::TestCase
doc = Nokogiri::XML(@wb.to_xml_string)
assert_equal pivot_table.cache_definition.rId, doc.xpath("//xmlns:pivotCache").first["r:id"]
end
-
+
def test_worksheet_name_is_intact_after_serialized_into_xml
sheet = @wb.add_worksheet(:name => '_Example')
wb_xml = Nokogiri::XML(@wb.to_xml_string)