Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/google_visualr/data_table.rb
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def verify_against_column_type(type, value)
when type == "string"
raise ArgumentError, "cell value '#{v}' is not a String", caller unless v.is_a?(String)
when type == "number"
raise ArgumentError, "cell value '#{v}' is not an Integer or a Float", caller unless v.is_a?(Integer) || v.is_a?(Float)
raise ArgumentError, "cell value '#{v}' is not an Integer, Float or BigDecimal", caller unless v.is_a?(Integer) || v.is_a?(Float) || v.is_a?(BigDecimal)
when type == "boolean"
raise ArgumentError, "cell value '#{v}' is not a Boolean", caller unless v.is_a?(TrueClass) || v.is_a?(FalseClass)
when type == 'datetime'
Expand Down
6 changes: 6 additions & 0 deletions spec/google_visualr/data_table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ def assert_raises_exception(col, value)
it "raises an exception if value is not date" do
assert_raises_exception(4, 'ABCD')
end

it "accepts BigDecimal as number" do
expect {
dt.set_cell(0, 1, BigDecimal.new(42))
}.to_not raise_exception(ArgumentError)
end
end

it "accepts 'nil' for all column types" do
Expand Down