From a9aed2ac94d2e0d1a233a3c193985ae78d7e79e9 Mon Sep 17 00:00:00 2001 From: Michael Grosser Date: Fri, 16 Sep 2016 09:44:05 -0700 Subject: 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 --- .../cases/associations/has_one_through_associations_test.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'activerecord/test/cases/associations/has_one_through_associations_test.rb') diff --git a/activerecord/test/cases/associations/has_one_through_associations_test.rb b/activerecord/test/cases/associations/has_one_through_associations_test.rb index e95eeb64db..b2f47d2daf 100644 --- a/activerecord/test/cases/associations/has_one_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_through_associations_test.rb @@ -182,7 +182,7 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase @member.organization = @organization end assert_equal @organization, @member.organization - assert @organization.members.include?(@member) + assert_includes @organization.members, @member assert_equal "Extra", @member.member_detail.extra_data end @@ -197,16 +197,16 @@ class HasOneThroughAssociationsTest < ActiveRecord::TestCase end assert_equal @organization, @member.organization assert_equal "Extra", @member.member_detail.extra_data - assert @organization.members.include?(@member) - assert !@new_organization.members.include?(@member) + assert_includes @organization.members, @member + assert_not_includes @new_organization.members, @member assert_no_difference "MemberDetail.count" do @member.organization = @new_organization end assert_equal @new_organization, @member.organization assert_equal "Extra", @member.member_detail.extra_data - assert !@organization.members.include?(@member) - assert @new_organization.members.include?(@member) + assert_not_includes @organization.members, @member + assert_includes @new_organization.members, @member end def test_preloading_has_one_through_on_belongs_to -- cgit v1.2.3