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/autosave_association_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/autosave_association_test.rb')
-rw-r--r-- | activerecord/test/cases/autosave_association_test.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/test/cases/autosave_association_test.rb b/activerecord/test/cases/autosave_association_test.rb index 08df945063..c6e983a106 100644 --- a/activerecord/test/cases/autosave_association_test.rb +++ b/activerecord/test/cases/autosave_association_test.rb @@ -585,7 +585,7 @@ class TestDefaultAutosaveAssociationOnAHasManyAssociation < ActiveRecord::TestCa firm.save firm.reload assert_equal 2, firm.clients.length - assert firm.clients.include?(companies(:second_client)) + assert_includes firm.clients, companies(:second_client) end def test_assign_ids_for_through_a_belongs_to @@ -594,7 +594,7 @@ class TestDefaultAutosaveAssociationOnAHasManyAssociation < ActiveRecord::TestCa post.save post.reload assert_equal 2, post.people.length - assert post.people.include?(people(:david)) + assert_includes post.people, people(:david) end def test_build_before_save @@ -647,7 +647,7 @@ class TestDefaultAutosaveAssociationOnAHasManyAssociation < ActiveRecord::TestCa assert firm.save firm.reload assert_equal 2, firm.clients.length - assert firm.clients.include?(Client.find_by_name("New Client")) + assert_includes firm.clients, Client.find_by_name("New Client") end end |