Testing Space Statistics Generator Implementation in PgHero
This test suite validates the PgHero space statistics generator functionality, ensuring proper database migration creation for tracking PostgreSQL space statistics. The test verifies the generator’s ability to create appropriate database tables and schema structures.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
ankane/pghero
test/space_stats_generator_test.rb
require_relative "test_helper"
require "generators/pghero/space_stats_generator"
class SpaceStatsGeneratorTest < Rails::Generators::TestCase
tests Pghero::Generators::SpaceStatsGenerator
destination File.expand_path("../tmp", __dir__)
setup :prepare_destination
def test_works
run_generator
assert_migration "db/migrate/create_pghero_space_stats.rb", /create_table :pghero_space_stats/
end
end