diff options
author | Arthur Nogueira Neves <github@arthurnn.com> | 2017-01-30 20:16:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-30 20:16:30 -0500 |
commit | 543f19626b80e72c543306b6ca67421df3a42d6c (patch) | |
tree | 5f1c9ab0575b88f4fdd92949389d82d4cebdd3d0 /activerecord/test/cases/associations | |
parent | 4e5c2ccc1d97f0c18834f616fc219be6b1531bde (diff) | |
parent | c42bd31977d601a743a154cf5a614459b51a3cb3 (diff) | |
download | rails-543f19626b80e72c543306b6ca67421df3a42d6c.tar.gz rails-543f19626b80e72c543306b6ca67421df3a42d6c.tar.bz2 rails-543f19626b80e72c543306b6ca67421df3a42d6c.zip |
Merge pull request #27797 from y-yagi/correctly_check_error_message
correctly check error message
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/eager_test.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/activerecord/test/cases/associations/eager_test.rb b/activerecord/test/cases/associations/eager_test.rb index 7d054b874b..11f4aae5b3 100644 --- a/activerecord/test/cases/associations/eager_test.rb +++ b/activerecord/test/cases/associations/eager_test.rb @@ -739,18 +739,25 @@ class EagerAssociationTest < ActiveRecord::TestCase end def test_eager_with_invalid_association_reference - assert_raise(ActiveRecord::AssociationNotFoundError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") { + e = assert_raise(ActiveRecord::AssociationNotFoundError) { Post.all.merge!(includes: :monkeys).find(6) } - assert_raise(ActiveRecord::AssociationNotFoundError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") { + assert_equal("Association named 'monkeys' was not found on Post; perhaps you misspelled it?", e.message) + + e = assert_raise(ActiveRecord::AssociationNotFoundError) { Post.all.merge!(includes: [ :monkeys ]).find(6) } - assert_raise(ActiveRecord::AssociationNotFoundError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys") { + assert_equal("Association named 'monkeys' was not found on Post; perhaps you misspelled it?", e.message) + + e = assert_raise(ActiveRecord::AssociationNotFoundError) { Post.all.merge!(includes: [ "monkeys" ]).find(6) } - assert_raise(ActiveRecord::AssociationNotFoundError, "Association was not found; perhaps you misspelled it? You specified :include => :monkeys, :elephants") { + assert_equal("Association named 'monkeys' was not found on Post; perhaps you misspelled it?", e.message) + + e = assert_raise(ActiveRecord::AssociationNotFoundError) { Post.all.merge!(includes: [ :monkeys, :elephants ]).find(6) } + assert_equal("Association named 'monkeys' was not found on Post; perhaps you misspelled it?", e.message) end def test_eager_has_many_through_with_order |