aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/calculations_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2012-06-24 06:42:41 -0700
committerRafael Mendonça França <rafaelmfranca@gmail.com>2012-06-24 10:47:17 -0300
commit12ac97707997f11ebda9d7527aaff14d079a2460 (patch)
tree7b18c47ace2000c1b19dd833243c56271768a833 /activerecord/test/cases/calculations_test.rb
parent200e6a6332aea3afebb88791ffdab4d352004cd6 (diff)
downloadrails-12ac97707997f11ebda9d7527aaff14d079a2460.tar.gz
rails-12ac97707997f11ebda9d7527aaff14d079a2460.tar.bz2
rails-12ac97707997f11ebda9d7527aaff14d079a2460.zip
Merge pull request #6842 from ernie/handle-non-strings-in-grouped-calculations
Stop assuming strings for grouped calculations Conflicts: activerecord/lib/active_record/relation/calculations.rb
Diffstat (limited to 'activerecord/test/cases/calculations_test.rb')
-rw-r--r--activerecord/test/cases/calculations_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb
index 66c801ca75..e50de46f9e 100644
--- a/activerecord/test/cases/calculations_test.rb
+++ b/activerecord/test/cases/calculations_test.rb
@@ -67,6 +67,11 @@ class CalculationsTest < ActiveRecord::TestCase
[1,6,2].each { |firm_id| assert c.keys.include?(firm_id) }
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) }
+ end
+
def test_should_group_by_multiple_fields
c = Account.count(:all, :group => ['firm_id', :credit_limit])
[ [nil, 50], [1, 50], [6, 50], [6, 55], [9, 53], [2, 60] ].each { |firm_and_limit| assert c.keys.include?(firm_and_limit) }