Test Rails apps with Minitest, not guesswork
Learn automated testing step by step, from CRUD to models, fixtures, system tests, mailers, jobs, and CI. Minitest, fixtures, and Rails defaults the whole way.
In an age where AI dominates the headlines, there has never been a more important time for real human in the loop testing. And when it comes to automated testing in Rails, Prabin Poudel is who I trust to get it right.
Start here in three steps
You don't have to read everything today. Follow this path and you'll have a real test running in your own app.
-
Step 1
See why Minitest fits Rails
Read the introduction: who this is for, how the Recipes app grows, and why you won't need to hunt for a second test stack.
-
Step 2
Set up the Recipes app
Spin up the sample app with Minitest and system tests wired the way later chapters expect.
-
Step 3
Write your first automated test
Turn a scenario into a failing test, make it pass, and build the habit of green before you commit.
Built for you if…
Whether you're on day one or you've been testing in RSpec for years, the guide meets you where you are.
-
New to Rails testing
You know you should write tests but not where to start. We go step by step with plain language, scenarios, and one app so nothing feels random.
-
Coming from RSpec
You want to see how Minitest holds up on a real Rails app without switching frameworks mid-project. Same problems, default stack.
-
Adding tests at work
You need a pattern for mailers, jobs, auth, or an existing codebase. Use the chapter you need, or follow the full path when you have time.
What you'll work through
All 22 chapters are free. One Recipes app. Start with the first six below, or open the full list when you're ready.
Introduction to Minitest Rails Guide
Why the Minitest Rails guide exists, who it's for (beginners and experienced alike), and how the Recipes app grows with you.
Setting up the Recipe app
Spin up the Recipes app with the Rails default with one addition: system tests which has been removed from defaults from Rails 8. Enough Capybara wiring to follow later chapters.
Types of tests in the Rails world
How model, controller, integration, and system tests fit together in Minitest, where they live under test/, and when to pick each for the Recipes app.
Testing tools in the Minitest world
Minitest, fixtures, Capybara, and when something like WebMock or VCR earns a place.
How to approach testing
Build scenarios in plain language, manual checks in the reference Recipes app, and practice drills with hidden example answers. No automated tests in this chapter.
Your first test
Scenario first, then code: Recipe scaffold, a model test that fails then passes, first HTTP integration tests (list + create), one system smoke test, and how to read passing output.
From the blog
All postsHow to Test Rails Built-in Authentication with Minitest
Test Rails built-in authentication in Minitest: session fixtures, sign_in_as helpers, protected route integration tests, and system tests for sign-in and protected controllers.
How to Test File Uploads with Minitest Rails
Test Active Storage uploads in Rails with Minitest: fixture files, model attach, integration multipart posts, and optional system tests. No real S3 in CI.