diff options
Diffstat (limited to 'activerecord/test/cases/calculations_test.rb')
-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 24bc4f71ce..c2e02763f6 100644 --- a/activerecord/test/cases/calculations_test.rb +++ b/activerecord/test/cases/calculations_test.rb @@ -2,6 +2,8 @@ require "cases/helper" require 'models/company' require 'models/topic' require 'models/edge' +require 'models/club' +require 'models/organization' Company.has_many :accounts @@ -223,6 +225,10 @@ class CalculationsTest < ActiveRecord::TestCase assert_equal 15, companies(:rails_core).companies.sum(:id) end + def test_should_sum_scoped_field_with_from + assert_equal Club.count, Organization.clubs.count + end + def test_should_sum_scoped_field_with_conditions assert_equal 8, companies(:rails_core).companies.sum(:id, :conditions => 'id > 7') end |