Testing Query Statistics Generator Implementation in PgHero
This test suite validates the QueryStats generator functionality in PgHero, ensuring proper creation of database migrations for query statistics tracking. The tests verify the generator’s ability to create the necessary database table and schema for storing PostgreSQL query performance metrics.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
ankane/pghero
test/query_stats_generator_test.rb
require_relative "test_helper"
require "generators/pghero/query_stats_generator"
class QueryStatsGeneratorTest < Rails::Generators::TestCase
tests Pghero::Generators::QueryStatsGenerator
destination File.expand_path("../tmp", __dir__)
setup :prepare_destination
def test_works
run_generator
assert_migration "db/migrate/create_pghero_query_stats.rb", /create_table :pghero_query_stats/
end
end