diff options
author | Michael Grosser <michael@grosser.it> | 2016-09-16 09:44:05 -0700 |
---|---|---|
committer | Michael Grosser <michael@grosser.it> | 2016-09-16 12:03:37 -0700 |
commit | a9aed2ac94d2e0d1a233a3c193985ae78d7e79e9 (patch) | |
tree | d550056dbf4a70b5c7562f1a715045c5a3968b0c /activerecord/test/cases/associations_test.rb | |
parent | f62451a50b2c9119adce7acc53ce3dfffc4d41d5 (diff) | |
download | rails-a9aed2ac94d2e0d1a233a3c193985ae78d7e79e9.tar.gz rails-a9aed2ac94d2e0d1a233a3c193985ae78d7e79e9.tar.bz2 rails-a9aed2ac94d2e0d1a233a3c193985ae78d7e79e9.zip |
improve error message when include assertions fail
assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message
assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
Diffstat (limited to 'activerecord/test/cases/associations_test.rb')
-rw-r--r-- | activerecord/test/cases/associations_test.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/cases/associations_test.rb b/activerecord/test/cases/associations_test.rb index 5222703570..c095b3a91c 100644 --- a/activerecord/test/cases/associations_test.rb +++ b/activerecord/test/cases/associations_test.rb @@ -131,7 +131,7 @@ class AssociationProxyTest < ActiveRecord::TestCase david.posts << (post = Post.new(title: "New on Edge", body: "More cool stuff!")) assert !david.posts.loaded? - assert david.posts.include?(post) + assert_includes david.posts, post end def test_push_has_many_through_does_not_load_target @@ -139,7 +139,7 @@ class AssociationProxyTest < ActiveRecord::TestCase david.categories << categories(:technology) assert !david.categories.loaded? - assert david.categories.include?(categories(:technology)) + assert_includes david.categories, categories(:technology) end def test_push_followed_by_save_does_not_load_target @@ -149,7 +149,7 @@ class AssociationProxyTest < ActiveRecord::TestCase assert !david.posts.loaded? david.save assert !david.posts.loaded? - assert david.posts.include?(post) + assert_includes david.posts, post end def test_push_does_not_lose_additions_to_new_record |