Test Driving Rails
The Minitest and fixtures guide for testing Rails applications.
- Learn about Minitest test cases, assertions, mocks and stubs.
- Design simple to use test data with fixtures.
- Write fast Rails models, controllers and system tests.
From beta readers
"An excellent resource for anyone aiming to master the default Rails testing framework – Minitest and fixtures."
Chapters
Getting started.
Introduction to Minitest
Mocks, Stubs, Mocha, constants.
The Rails test layout.
Building test data with fixtures.
Testing models and business logic.
Testing controllers and flows.
Testing with browsers.
Continues integration.
A handy reference.
What did we learn.
Check out the preview
FAQ
Which versions of Rails are covered?
The 1st edition of the book targets the currently unreleased Rails 8.
Who is the book for?
The book is designed for Rails beginners and professionals alike, but basic knowledge of Rails is assumed. Previous experience with Minitest or fixtures is not required.
Is Minitest worth it if I use RSpec?
Minitest is seemlesly integrated with Rails from the get-go. You don't need to update your gemfile or think about specific features when they come out.
What about factories?
This book talks exclusively about building test data with Rails fixtures. They are fast and reusable datasets for different tasks across development, test, and production.