From 788eb51df3007d94b266965433b0be88a23b84c5 Mon Sep 17 00:00:00 2001 From: Yuya Tanaka Date: Wed, 6 Feb 2019 12:29:28 +0900 Subject: Fix `CollectionProxy#concat` to return self by alias it to `#<<` Formerly it was returning arguments (`records` array). --- .../test/cases/associations/has_many_through_associations_test.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'activerecord/test/cases/associations/has_many_through_associations_test.rb') 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 0133beccec..0ac56c6168 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -242,9 +242,10 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase def test_concat person = people(:david) post = posts(:thinking) - post.people.concat [person] + result = post.people.concat [person] assert_equal 1, post.people.size assert_equal 1, post.people.reload.size + assert_equal post.people, result end def test_associate_existing_record_twice_should_add_to_target_twice -- cgit v1.2.3