aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/calculations_test.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-12-10 05:29:25 -0800
committerYves Senn <yves.senn@gmail.com>2013-12-10 05:29:25 -0800
commit821153525cefb1a809be06ae584f24f5c0c11323 (patch)
tree0805065b06a20007a7c5ca7dbacee802d5a3ece5 /activerecord/test/cases/calculations_test.rb
parent900191fe2c7eea88c625deb824e995bc7b5e914d (diff)
parent2a7fe7ae9b09024acea3c5d525c89b91bdb264a1 (diff)
downloadrails-821153525cefb1a809be06ae584f24f5c0c11323.tar.gz
rails-821153525cefb1a809be06ae584f24f5c0c11323.tar.bz2
rails-821153525cefb1a809be06ae584f24f5c0c11323.zip
Merge pull request #13236 from jetthoughts/13230_type_cast_bug_in_agr_functions
Fix type cast on group sum with custom expression
Diffstat (limited to 'activerecord/test/cases/calculations_test.rb')
-rw-r--r--activerecord/test/cases/calculations_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb
index 2c41656b3d..2f6913167d 100644
--- a/activerecord/test/cases/calculations_test.rb
+++ b/activerecord/test/cases/calculations_test.rb
@@ -211,6 +211,10 @@ class CalculationsTest < ActiveRecord::TestCase
assert_equal 19.83, NumericData.sum(:bank_balance)
end
+ def test_should_return_type_casted_values_with_group_and_expression
+ assert_equal 0.5, Account.group(:firm_name).sum('0.01 * credit_limit')['37signals']
+ end
+
def test_should_group_by_summed_field_with_conditions
c = Account.where('firm_id > 1').group(:firm_id).sum(:credit_limit)
assert_nil c[1]