Testing for Ruby on Railss
Testing in Rails uses Minitest by default, with fixtures or factories for data, and several test types: model tests, controller or request tests, and system tests that drive a real browser through Capybara. Running them in continuous integration catches regressions before they reach production.
Stage: Quality and Deployment · Part of the Ruby on Rails roadmap · Last reviewed 19 November 2026
What to learn in Testing
- Write a model test for a validation
- Test a controller action through an integration request
- Create test data with fixtures or FactoryBot
- Write a system test that fills in a form and checks the page
- Run the suite on every push in CI
Testing interview questions
What is the difference between a request test and a system test?
A request test sends HTTP requests directly to the app and checks status, redirects and response body, and is fast. A system test drives a real or headless browser, so it exercises JavaScript and full user flows, but runs slower.
What is the advantage of fixtures over factories?
Fixtures are YAML data loaded once into the database, so tests start quickly. Factories build records on demand and make each test's data explicit, which can be clearer but slower. Rails defaults to fixtures, and many teams choose FactoryBot.
Where Testing fits in the Ruby on Rails roadmap
Testing belongs to the Quality and Deployment stage (advanced level). Ship.
Other units in this stage
Back to the full Ruby on Rails roadmap