aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorthedarkone <thedarkone2@gmail.com>2014-03-30 20:52:01 +0200
committerthedarkone <thedarkone2@gmail.com>2014-03-30 20:52:01 +0200
commit055942d6c526de3a037e76e14954229888668515 (patch)
tree6c0c34445f4c447078f445f1cf35994af7f35cae /activerecord/test
parentde32d972bfde8871f7c1a4621f2223ea9b6715b2 (diff)
downloadrails-055942d6c526de3a037e76e14954229888668515.tar.gz
rails-055942d6c526de3a037e76e14954229888668515.tar.bz2
rails-055942d6c526de3a037e76e14954229888668515.zip
Simplify Preloader#grouped_records code.
The new method relies on AR::Associations::Association knowing about both reflection and a model class. AR::Base#association now raises a descriptive error when trying to access non-existent associations. Previously it would blow up with a confusing NoMethodError: undefined method `association_class' for nil:NilClass.
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/associations/eager_test.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb
index d594697280..8c9797861c 100644
--- a/activerecord/test/cases/associations/eager_test.rb
+++ b/activerecord/test/cases/associations/eager_test.rb
@@ -720,16 +720,16 @@ class EagerAssociationTest < ActiveRecord::TestCase
end
def test_eager_with_invalid_association_reference
- assert_raise(ActiveRecord::ConfigurationError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") {
+ assert_raise(ActiveRecord::AssociationNotFoundError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") {
Post.all.merge!(:includes=> :monkeys ).find(6)
}
- assert_raise(ActiveRecord::ConfigurationError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") {
+ assert_raise(ActiveRecord::AssociationNotFoundError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") {
Post.all.merge!(:includes=>[ :monkeys ]).find(6)
}
- assert_raise(ActiveRecord::ConfigurationError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") {
+ assert_raise(ActiveRecord::AssociationNotFoundError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") {
Post.all.merge!(:includes=>[ 'monkeys' ]).find(6)
}
- assert_raise(ActiveRecord::ConfigurationError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys, :elephants") {
+ assert_raise(ActiveRecord::AssociationNotFoundError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys, :elephants") {
Post.all.merge!(:includes=>[ :monkeys, :elephants ]).find(6)
}
end