summaryrefslogtreecommitdiffhomepage
path: root/test/workbook
diff options
context:
space:
mode:
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)