summaryrefslogtreecommitdiffhomepage
path: root/test/workbook
diff options
context:
space:
mode:
authorJonathan Tron <[email protected]>2012-02-22 18:56:53 +0100
committerJonathan Tron <[email protected]>2012-02-22 18:56:53 +0100
commit7d288efdc175dd9db030ada073aab360ea1b6b95 (patch)
treeea7a4a5bcfca4f8d4eed42bc108af809e31bfd43 /test/workbook
parentac16190cdd4b0d20ec25f3d92b9e842b1ea51348 (diff)
downloadcaxlsx-7d288efdc175dd9db030ada073aab360ea1b6b95.tar.gz
caxlsx-7d288efdc175dd9db030ada073aab360ea1b6b95.zip
Add :date support to Axlsx::Cell and add missing part for boolean support
- date is now separated from Time support so that it does not include unwanted hours/minutes/seconds - missing boolean support was the xml generation specific to :boolean type
Diffstat (limited to 'test/workbook')
-rw-r--r--test/workbook/worksheet/tc_cell.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/test/workbook/worksheet/tc_cell.rb b/test/workbook/worksheet/tc_cell.rb
index d9a1b351..f288a867 100644
--- a/test/workbook/worksheet/tc_cell.rb
+++ b/test/workbook/worksheet/tc_cell.rb
@@ -51,15 +51,17 @@ class TestCell < Test::Unit::TestCase
end
def test_type
- assert_raise(ArgumentError, "type must be :string, :integer, :float, :time, :boolean") { @c.type = :array }
+ assert_raise(ArgumentError, "type must be :string, :integer, :float, :date, :time, :boolean") { @c.type = :array }
assert_nothing_raised("type can be changed") { @c.type = :string }
assert_equal(@c.value, "1.0", "changing type casts the value")
assert_equal(@row.add_cell(Time.now).type, :time, 'time should be time')
+ assert_equal(@row.add_cell(Date.today).type, :date, 'date should be date')
+ assert_equal(@row.add_cell(true).type, :boolean, 'boolean should be boolean')
end
def test_value
- assert_raise(ArgumentError, "type must be :string, :integer, :float, :time") { @c.type = :array }
+ assert_raise(ArgumentError, "type must be :string, :integer, :float, :date, :time, :boolean") { @c.type = :array }
assert_nothing_raised("type can be changed") { @c.type = :string }
assert_equal(@c.value, "1.0", "changing type casts the value")
end
@@ -71,6 +73,7 @@ class TestCell < Test::Unit::TestCase
def test_cell_type_from_value
assert_equal(@c.send(:cell_type_from_value, 1.0), :float)
assert_equal(@c.send(:cell_type_from_value, 1), :integer)
+ assert_equal(@c.send(:cell_type_from_value, Date.today), :date)
assert_equal(@c.send(:cell_type_from_value, Time.now), :time)
assert_equal(@c.send(:cell_type_from_value, []), :string)
assert_equal(@c.send(:cell_type_from_value, "d"), :string)