diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-25 17:36:24 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-25 18:31:59 -0300 |
commit | e5abb89c54ed04e4811cec84c38742e4a6a0c4c5 (patch) | |
tree | 1561067c9edd033124f9ae5a13cc2c96a7c21001 /activerecord/test/cases | |
parent | 07875be977aae8d95df33a5fa43d30562cd2b1df (diff) | |
download | rails-e5abb89c54ed04e4811cec84c38742e4a6a0c4c5.tar.gz rails-e5abb89c54ed04e4811cec84c38742e4a6a0c4c5.tar.bz2 rails-e5abb89c54ed04e4811cec84c38742e4a6a0c4c5.zip |
Ensure Arel columns are typecasted properly when grouping with calculation
Fix build issue with postgresql.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/calculations_test.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb index b766b92007..e1c1e449ef 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -58,12 +58,16 @@ class CalculationsTest < ActiveRecord::TestCase def test_should_group_by_field c = Account.group(:firm_id).sum(:credit_limit) - [1,6,2].each { |firm_id| assert c.keys.include?(firm_id) } + [1,6,2].each do |firm_id| + assert c.keys.include?(firm_id), "Group #{c.inspect} does not contain firm_id #{firm_id}" + end end def test_should_group_by_arel_attribute - c = Account.sum(:credit_limit, :group => Account.arel_table[:firm_id]) - [1,6,2].each { |firm_id| assert c.keys.include?(firm_id) } + c = Account.group(Account.arel_table[:firm_id]).sum(:credit_limit) + [1,6,2].each do |firm_id| + assert c.keys.include?(firm_id), "Group #{c.inspect} does not contain firm_id #{firm_id}" + end end def test_should_group_by_multiple_fields |