aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/calculations_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-06-03 21:19:36 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-06-03 21:19:36 +0000
commit4394e402b7a482675ceb5ab9e832defe930bd71e (patch)
tree2ac0fdd10f15f799bb24d924f3baff49dcfe1b15 /activerecord/test/calculations_test.rb
parent16716090632d499eb6bfc8afdea2784eb6f5963d (diff)
downloadrails-4394e402b7a482675ceb5ab9e832defe930bd71e.tar.gz
rails-4394e402b7a482675ceb5ab9e832defe930bd71e.tar.bz2
rails-4394e402b7a482675ceb5ab9e832defe930bd71e.zip
Fixed that count distinct should use the selected column even when using :include (closes #5251) [anna@wota.jp]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4417 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/calculations_test.rb')
-rw-r--r--activerecord/test/calculations_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/calculations_test.rb b/activerecord/test/calculations_test.rb
index c4e41b1dda..785a4d10b4 100644
--- a/activerecord/test/calculations_test.rb
+++ b/activerecord/test/calculations_test.rb
@@ -187,4 +187,9 @@ class CalculationsTest < Test::Unit::TestCase
assert_raises(ArgumentError) { Company.send(:validate_calculation_options, :sum, :foo => :bar) }
assert_raises(ArgumentError) { Company.send(:validate_calculation_options, :count, :foo => :bar) }
end
+
+ def test_should_count_selected_field_with_include
+ assert_equal 5, Account.count(:distinct => true, :include => :firm)
+ assert_equal 3, Account.count(:distinct => true, :include => :firm, :select => :credit_limit)
+ end
end