Class: BugTest

Inherits:
Minitest::Test
  • Object
show all
Defined in:
build/mongoid-7.4/examples/mongoid_test.rb

Instance Method Summary collapse

Instance Method Details

#test_query_countObject



29
30
31
32
33
34
35
36
37
38
39
# File 'build/mongoid-7.4/examples/mongoid_test.rb', line 29

def test_query_count
  p = Person.create!(name: 'arthurnn')
  Post.create!(person: p)
  Post.create!(person: p)

  query_counter = count_queries do
    Person.includes(:posts).all.to_a
  end

  assert_equal 2, query_counter
end