| | 1267 | class FloatsAndInts < ActiveRecord::Base; end |
|---|
| | 1268 | |
|---|
| | 1269 | # Mirroring the test_integers_as_nil test way above |
|---|
| | 1270 | def test_floats_as_nil |
|---|
| | 1271 | test = FloatsAndInts.create(:a_float_column => '') |
|---|
| | 1272 | assert_nil FloatsAndInts.find(test.id).a_float_column |
|---|
| | 1273 | end |
|---|
| | 1274 | |
|---|
| | 1275 | def test_we_get_integers_as_values_for_our_integer_columns_after_setting_other_values |
|---|
| | 1276 | [[], {}, Date.today, true].each do |v| |
|---|
| | 1277 | f = FloatsAndInts.create(:an_integer_column => v) |
|---|
| | 1278 | assert f.an_integer_column.class <= Integer |
|---|
| | 1279 | end |
|---|
| | 1280 | end |
|---|
| | 1281 | |
|---|
| | 1282 | def test_we_get_floats_as_values_for_our_float_columns_after_setting_other_values |
|---|
| | 1283 | [[], {}, Date.today, true].each do |v| |
|---|
| | 1284 | f = FloatsAndInts.create(:a_float_column => v) |
|---|
| | 1285 | assert f.a_float_column.class <= Float |
|---|
| | 1286 | end |
|---|
| | 1287 | end |
|---|
| | 1288 | |
|---|