If you’ve ever tested a Rails app, you’ve probably used factory_bot. For over twenty years, it’s been the backbone of countless test suites, trusted by everyone from small startups to Fortune 500 companies.
But for all its popularity, few developers know how factory_bot actually works under the hood or how to extend it for their own unique needs.
At thoughtbot Open Summit on October 31, thoughtbot Senior Developers Neil Carvalho and José Blanco are leading a hands-on session designed for developers who already rely on factory_bot and want to take the next step: building custom strategies.
In their session, they’ll demonstrate how to extend and adapt factory_bot to fit your team’s unique needs by building custom strategies that shape how test data is setup and how this can be applied to how your tests are created, run, and maintained.
The power of custom strategies
Most Rails developers know how to call create or build in their factories—but those methods are part of a larger system of strategies. Strategies tell factory_bot what to do when you construct a record: should it be saved to the database, just instantiated, or handled in a completely different way?
In this session, Neil and José will show how you can extend that system to fit your own application’s needs.
You’ll learn:
- What the four existing factory_bot strategies are and how they work internally
- How to build a custom strategy live during the session
- How to navigate the gem’s code to understand its design patterns
- When and why creating a custom strategy can simplify your test suite
Inside the session
This is not a 101. It’s a fast-paced, 1 hour session for developers who already feel comfortable writing factories and want to extend factory_bot itself.
The session will kick off with a short overview of the gem’s internals, followed by live coding. Neil and José will walk through the strategy pattern, explore how factory_bot processes factory definitions, and then build custom strategies in real-time—inviting audience ideas for what to create.
The goal is to make the gem’s complexity approachable and show that contributing or extending factory_bot isn’t as intimidating as it might seem.
Why it matters
Custom strategies open up a world of flexibility. They can help you:
- Integrate factory_bot more tightly with your application’s domain logic
- Simplify complex test setups without adding clutter
- Explore how one of Rails’ most enduring gems is structured internally
Join the session live
Whether you’re building large, complex Rails apps or just want to understand how factory_bot ticks, this workshop will give you new tools and new confidence to work directly with the gem’s internals.
Come ready to contribute, ask questions, and walk away with a deeper understanding of one of Rails’ most powerful testing tools.
We hope you’ll join us live at thoughtbot Open Summit on October 31, 2025!
Sign up and bring your team: https://thoughtbot.com/events/open-summit