Sha256: 21b66a4e9d8854f4769820af67fce8fd28358d58a4aaadfc1cc2f32f83c12e33
Contents?: true
Size: 871 Bytes
Versions: 4
Compression:
Stored size: 871 Bytes
Contents
# frozen_string_literal: true require "cases/helper" require "models/author" require "models/post" class PostgreSQLExplainTest < ActiveRecord::PostgreSQLTestCase fixtures :authors def test_explain_for_one_query explain = Author.where(id: 1).explain assert_match %r(EXPLAIN for: SELECT "authors"\.\* FROM "authors" WHERE "authors"\."id" = (?:\$1 \[\["id", 1\]\]|1)), explain assert_match %(QUERY PLAN), explain end def test_explain_with_eager_loading explain = Author.where(id: 1).includes(:posts).explain assert_match %(QUERY PLAN), explain assert_match %r(EXPLAIN for: SELECT "authors"\.\* FROM "authors" WHERE "authors"\."id" = (?:\$1 \[\["id", 1\]\]|1)), explain assert_match %r(EXPLAIN for: SELECT "posts"\.\* FROM "posts" WHERE "posts"\."author_id" = (?:\$1 \[\["author_id", 1\]\]|1)), explain end end
Version data entries
4 entries across 4 versions & 1 rubygems