diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-08-11 16:09:15 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-11 16:09:15 -0400 |
commit | aa1b03913319e4bb4f4b57d368fa4a0f9915aebd (patch) | |
tree | e8bec0be9b8dc5f305b757ae1278219b26c10cbc /activerecord/test/cases/associations | |
parent | 043f83fed3ff454a4b3735b3388541b9583bb4c4 (diff) | |
parent | 702e36e2f303aa5864209d43c25f1b9008ae976e (diff) | |
download | rails-aa1b03913319e4bb4f4b57d368fa4a0f9915aebd.tar.gz rails-aa1b03913319e4bb4f4b57d368fa4a0f9915aebd.tar.bz2 rails-aa1b03913319e4bb4f4b57d368fa4a0f9915aebd.zip |
Merge pull request #29720 from gaurish/ar_find_error_message_improvement
Return Not found Ids in ActiveRecord::NotFound
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index c5e35a146b..4c2723addc 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -891,7 +891,8 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase company = companies(:rails_core) ids = [Developer.first.id, -9999] e = assert_raises(ActiveRecord::RecordNotFound) { company.developer_ids = ids } - assert_match(/Couldn't find all Developers with 'id'/, e.message) + msg = "Couldn't find all Developers with 'id': (1, -9999) (found 1 results, but was looking for 2). Couldn't find Developer with id -9999." + assert_equal(msg, e.message) end def test_collection_singular_ids_setter_raises_exception_when_invalid_ids_set_with_changed_primary_key @@ -905,7 +906,8 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase author = authors(:david) ids = [categories(:general).name, "Unknown"] e = assert_raises(ActiveRecord::RecordNotFound) { author.essay_category_ids = ids } - assert_equal "Couldn't find all Categories with 'name': (General, Unknown) (found 1 results, but was looking for 2)", e.message + msg = "Couldn't find all Categories with 'name': (General, Unknown) (found 1 results, but was looking for 2). Couldn't find Category with name Unknown." + assert_equal msg, e.message end def test_build_a_model_from_hm_through_association_with_where_clause |