only
$34.99

Test Driving Rails

Just updated for Rails 8.1 and Minitest 6

Learn how to test your Rails applications with Minitest and fixtures.

Testimonials

"Test Driving Rails is a concise yet incredibly complete guide to the patterns and tools we use to effectively test our Ruby on Rails applications, ensuring that our software does exactly what we said it would, every time we make a change."

Steven R. Baker
the author of minitest/mock and RSpec

"The book does a great job of showing how far you can get by simply using what Rails already gives you. It’s practical, focused, and free of unnecessary ceremony."

Carmine Paolino
the author of RubyLLM

"It's the perfect book to get you up to speed using the default testing framework for Rails, perfectly complementing the official guides. Short & sweet."

Andrei Maxim
a Ruby developer

"An excellent resource for anyone aiming to master the default Rails testing framework – Minitest and fixtures."

Juraj Kostolanský
a full-stack Rails developer

"I started a new project with factories, but thanks to this book I made my tests 32% faster with fixtures."

Patrick Barattin
a Rails developer

Chapters

Includes foreword by Steven R. Baker
the author of minitest/mock and RSpec
1. Introduction

Getting started.

2. Minitest

Introduction to Minitest

3. Doubles

Mocks, Stubs, Mocha, constants.

4. Testing Rails

The Rails test layout.

5. Fixtures

Building test data with fixtures.

6. Model tests

Testing models and business logic.

7. Integration tests

Testing controllers and flows.

8. System tests

Testing with browsers.

9. CI

Continuous integration.

10. Databases

Optimize SQLite, MySQL, and PostgreSQL.

11. Reference

A handy reference.

12. Fin

What did we learn.

Model tests

Model tests should test your models and business logic. This means Active Model, Active Record, or any other Ruby object usually found in app/models. These tests are straightforward to write and fast to execute, so they should be the backbone of your test suite.
Callbacks
Concerns
Attachments
Queues and Jobs
Action Cable
Emails
Service layer
Time
HTTP services

Controller tests

Rails applications are first and foremost web applications handling client HTTP requests. We test responses to these requests with integration and controller tests, both based on ActionDispatch::IntegrationTest.
Actions
Responses
Cookies
Pagination
Attachments
Translations

System tests

System tests, which are usually known as end-to-end tests outside of Rails, are designed to test the entire application from the user's perspective. These tests simulate real user interactions by running a real or headless web browser.
Actions
Finders
Matchers
Sessions
Timeouts
Time
Screenshots

Databases

We usually spend a lot of time optimizing databases for production. But test environments have very different goals and using production configuration lead to slower tests.
SQLite
MySQL
PostgreSQL

Check out the preview

Buy a copy

Just $34.99 + tax for PDF, ePUB, bonuses, and lifetime updates

FREE bonus

Claude skills

Join the agentic revolution by incorporating premade Claude Skills for Claude Code to set up and write your tests. You can use the setup to optimize your current state.

setup-tests

write-test

FAQ

Which versions of Rails are covered?

The first update of the 1st edition targets Rails 8.1 and Minitest 6, but also works well for previous versions.

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.

Fixtures instead of 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.

What about updates?

This book comes with free lifetime updates if you buy this first edition. Last update happened on 16. 2. 2026.

Buy now

Just $34.99 + tax for PDF, ePUB, bonuses, and lifetime updates

Writing

Check out some of my Minitest posts:

Author

Hello, I am Josef Strzibny, author of Kamal Handbook and a Rails engineer previously working for companies like Red Hat and Phrase. I always had a soft spot for the default Rails testing stack and I want to show you how easy it can be.