← Graph

How to optimize tests around callbacks without refactoring?

question 2 connections

Audience asks how to apply build-over-create when the existing codebase uses many ActiveRecord callbacks. Hasiński: you can't really avoid refactoring. His approach is to remove the callback while keeping the method, see which tests/code paths fail, and convert those into explicit method invocations. Not a silver bullet but makes behavior explicit instead of implicit.

answer_summary
No silver bullet — remove callbacks, observe failures, and replace them with explicit method calls at the call sites.
question How to optimize tests around callbacks without refactoring?
about
Question is about applying the build-over-create approach on callback-heavy codebases.
question How to optimize tests around callbacks without refactoring?
asked_at
Asked during the Q&A after the build-vs-create section.

Provenance

Read by
1 extraction