diff options
| author | Ken Collins <ken@metaskills.net> | 2011-02-03 15:07:03 -0500 |
|---|---|---|
| committer | Santiago Pastorino <santiago@wyeworks.com> | 2011-02-03 20:00:51 -0200 |
| commit | 95d5d9b6c48c08f1fba0c77ecbc97b62b2603824 (patch) | |
| tree | dac3893d280838cf33ba9ac22e687501490fe803 /activerecord/test | |
| parent | 092a4e296de5b69f06edac2fe0993e2a30e33555 (diff) | |
| download | rails-95d5d9b6c48c08f1fba0c77ecbc97b62b2603824.tar.gz rails-95d5d9b6c48c08f1fba0c77ecbc97b62b2603824.tar.bz2 rails-95d5d9b6c48c08f1fba0c77ecbc97b62b2603824.zip | |
The type_cast_calculated_value method will trust DB types before casting to a BigDecimal.
[#6365 state:committed]
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/test')
| -rw-r--r-- | activerecord/test/cases/calculations_test.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index 644c9cb528..3121f1615d 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -28,6 +28,12 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal 3.5, value end + def test_should_return_integer_average_if_db_returns_such + Account.connection.stubs :select_value => 3 + value = Account.average(:id) + assert_equal 3, value + end + def test_should_return_nil_as_average assert_nil NumericData.average(:bank_balance) end |
