diff options
author | Matt Jones <al2o3cr@gmail.com> | 2018-08-30 16:53:16 -0400 |
---|---|---|
committer | Eileen Uchitelle <eileencodes@gmail.com> | 2018-10-04 11:05:21 -0400 |
commit | 4429540995b061cf120b6468ce76cbb44fcaba9c (patch) | |
tree | c415871e9bd666ac742b796b9b403403f1462cfb | |
parent | ddac80a951beb307d5d7adb781f6dd1d1f169f7e (diff) | |
download | rails-4429540995b061cf120b6468ce76cbb44fcaba9c.tar.gz rails-4429540995b061cf120b6468ce76cbb44fcaba9c.tar.bz2 rails-4429540995b061cf120b6468ce76cbb44fcaba9c.zip |
failing test for eager loading
cherry-picked from https://github.com/rails/rails/pull/33763
-rw-r--r-- | activerecord/test/cases/associations/cascaded_eager_loading_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb index 4cbc65b6d8..a9e22c7643 100644 --- a/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +++ b/activerecord/test/cases/associations/cascaded_eager_loading_test.rb @@ -165,6 +165,11 @@ class CascadedEagerLoadingTest < ActiveRecord::TestCase assert_no_queries { assert_nil post.author } end + def test_eager_association_loading_with_missing_first_record + posts = Post.where(id: 3).preload(author: { comments: :post }).to_a + assert_equal posts.size, 1 + end + def test_eager_association_loading_with_recursive_cascading_four_levels_has_many_through source = Vertex.all.merge!(includes: { sinks: { sinks: { sinks: :sinks } } }, order: "vertices.id").first assert_equal vertices(:vertex_4), assert_no_queries { source.sinks.first.sinks.first.sinks.first } |