diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-29 17:06:27 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-29 17:06:27 +0000 |
commit | 3704088ebde5ef074d186bff0d380858a9a01055 (patch) | |
tree | cae788b86554be381aff084f7b3da48a4fc428b4 /activerecord/test/calculations_test.rb | |
parent | 92f1e26a1c9f48ac575414976012d6dfa127bdac (diff) | |
download | rails-3704088ebde5ef074d186bff0d380858a9a01055.tar.gz rails-3704088ebde5ef074d186bff0d380858a9a01055.tar.bz2 rails-3704088ebde5ef074d186bff0d380858a9a01055.zip |
has_one supports the :dependent => :delete option which skips the typical callback chain and deletes the associated object directly from the database. Closes #5927.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4848 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/calculations_test.rb')
-rw-r--r-- | activerecord/test/calculations_test.rb | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/activerecord/test/calculations_test.rb b/activerecord/test/calculations_test.rb index 9a0d0434a5..397b7a9026 100644 --- a/activerecord/test/calculations_test.rb +++ b/activerecord/test/calculations_test.rb @@ -8,7 +8,7 @@ class CalculationsTest < Test::Unit::TestCase fixtures :companies, :accounts, :topics def test_should_sum_field - assert_equal 265, Account.sum(:credit_limit) + assert_equal 318, Account.sum(:credit_limit) end def test_should_average_field @@ -49,13 +49,13 @@ class CalculationsTest < Test::Unit::TestCase def test_should_order_by_grouped_field c = Account.sum(:credit_limit, :group => :firm_id, :order => "firm_id") - assert_equal [1, 2, 6], c.keys.compact + assert_equal [1, 2, 6, 9], c.keys.compact end def test_should_order_by_calculation c = Account.sum(:credit_limit, :group => :firm_id, :order => "sum_credit_limit desc, firm_id") - assert_equal [105, 60, 50, 50], c.keys.collect { |k| c[k] } - assert_equal [6, 2, 1], c.keys.compact + assert_equal [105, 60, 53, 50, 50], c.keys.collect { |k| c[k] } + assert_equal [6, 2, 9, 1], c.keys.compact end def test_should_limit_calculation @@ -114,8 +114,8 @@ class CalculationsTest < Test::Unit::TestCase end def test_should_calculate_with_invalid_field - assert_equal 5, Account.calculate(:count, '*') - assert_equal 5, Account.calculate(:count, :all) + assert_equal 6, Account.calculate(:count, '*') + assert_equal 6, Account.calculate(:count, :all) end def test_should_calculate_grouped_with_invalid_field @@ -193,7 +193,7 @@ class CalculationsTest < Test::Unit::TestCase 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) + assert_equal 6, Account.count(:distinct => true, :include => :firm) + assert_equal 4, Account.count(:distinct => true, :include => :firm, :select => :credit_limit) end end |