Permalink
Browse files

Be sure that test fixtures satisfy referential integrity before calcu…

…lating

There exists some other test files that load :minivans fixtures but don't load :speedometers.
Loading :speedometers here prevents the following error when this test was run after such test:
CalculationsTest#test_should_group_by_association_with_non_numeric_foreign_key:
ActiveRecord::RecordNotFound: Couldn't find all Speedometers with 'speedometer_id': (ABC, s1) (found 1 results, but was looking for 2)
  • Loading branch information...
1 parent 4ded131 commit 9489b212eb1e9bc3972f968a4d0213390db853a9 @amatsuda amatsuda committed Aug 28, 2014
Showing with 1 addition and 1 deletion.
  1. +1 −1 activerecord/test/cases/calculations_test.rb
@@ -22,7 +22,7 @@ class NumericData < ActiveRecord::Base
end
class CalculationsTest < ActiveRecord::TestCase
- fixtures :companies, :accounts, :topics
+ fixtures :companies, :accounts, :topics, :speedometers, :minivans
def test_should_sum_field
assert_equal 318, Account.sum(:credit_limit)

0 comments on commit 9489b21

Please sign in to comment.