Class: BugTest

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

Instance Method Summary collapse

Instance Method Details

#test_query_countObject



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

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