summaryrefslogtreecommitdiffhomepage
path: root/test/workbook/worksheet/tc_col.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-10-21 08:11:26 +0900
committerRandy Morgan <[email protected]>2012-10-21 08:11:26 +0900
commit45dad9aa611a24b69bfe10ba8207b60378d21d58 (patch)
tree28cba28dca7b72a9b9021b814a39a3e19c5b1cba /test/workbook/worksheet/tc_col.rb
parent9aa3ce12dfe60ec88e14166f71d1b60fba085d9a (diff)
downloadcaxlsx-45dad9aa611a24b69bfe10ba8207b60378d21d58.tar.gz
caxlsx-45dad9aa611a24b69bfe10ba8207b60378d21d58.zip
Fixed and added specs for best_fit and custom_width attribute serialization
Diffstat (limited to 'test/workbook/worksheet/tc_col.rb')
-rw-r--r--test/workbook/worksheet/tc_col.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/workbook/worksheet/tc_col.rb b/test/workbook/worksheet/tc_col.rb
index 9621eb14..c0c5e64b 100644
--- a/test/workbook/worksheet/tc_col.rb
+++ b/test/workbook/worksheet/tc_col.rb
@@ -58,6 +58,16 @@ class TestCol < Test::Unit::TestCase
assert_nothing_raised(ArgumentError, 'phonetic must be boolean(ish)') { @col.phonetic = true }
end
+ def test_to_xml_string
+ @col.width = 100
+ doc = Nokogiri::XML(@col.to_xml_string)
+ assert_equal(1, doc.xpath("//col [@bestFit='#{@col.best_fit}']").size)
+ assert_equal(1, doc.xpath("//col [@max=#{@col.max}]").size)
+ assert_equal(1, doc.xpath("//col [@min=#{@col.min}]").size)
+ assert_equal(1, doc.xpath("//col [@width=#{@col.width}]").size)
+ assert_equal(1, doc.xpath("//col [@customWidth='#{@col.custom_width}']").size)
+ end
+
def test_style
assert_equal(@col.style, nil)
@col.style = 1