Skip to content

Use with_model for test database setup - #110

Closed
nertzy wants to merge 1 commit into
rdy:masterfrom
nertzy:with-model-test-unit
Closed

Use with_model for test database setup#110
nertzy wants to merge 1 commit into
rdy:masterfrom
nertzy:with-model-test-unit

Conversation

@nertzy

@nertzy nertzy commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

fixture_builder's Test::Unit suite currently owns a procedural database
helper that reconnects to SQLite and builds five tables at individual
test call sites. with_model 2.4 now provides Test::Unit lifecycle
integration, so the schema can instead follow each test's setup and
teardown automatically.

This replaces TestDatabase with a shared declarative TestSchema
using fixed-name with_table declarations. Keeping the existing table
names preserves fixture filenames and fixture_builder's model
inference.

The lifecycle also resets Active Record's fixture cache before setup,
refreshes model column information after table creation, and retains
the generated-fixture cleanup performed after each test.

with_model 2.4 adds Test::Unit lifecycle integration, allowing the
test suite to declare its tables instead of rebuilding the connection
and schema procedurally at individual call sites.

Replace TestDatabase with fixed-name with_table declarations so model
inference and fixture filenames remain unchanged. Reset fixture and
column caches at their lifecycle boundaries, and preserve generated
fixture cleanup.
@nertzy

nertzy commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by the maintainer-owned stack beginning with #112 and #113. The remaining test-lifecycle migration will land as the top layer of that stack.

@nertzy nertzy closed this Sep 5, 2026
nertzy added a commit that referenced this pull request Sep 5, 2026
Use with_model and with_table to give each Test::Unit case the fixed
tables and model constants it exercises. Remove the suite-wide database
reconnect and migration helper while preserving explicit manual boundaries
for autoloading, separate pools, and raw SQL behavior.

#110
nertzy added a commit that referenced this pull request Sep 5, 2026
Use with_model and with_table to give each Test::Unit case the fixed
tables and model constants it exercises. Remove the suite-wide database
reconnect and migration helper while preserving explicit manual boundaries
for autoloading, separate pools, and raw SQL behavior.

#110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant