Loading…
6+ curated questions with the same answer shape every time: quick recap, deep dive, pitfalls, and follow-ups. Coverage includes rspec minitest basics, model controller tests.
Suggested path
Topics follow a teaching order. Each answer ends with a clear Next question control so you can move forward without hunting the list.
Rails testing basics interview questions for freshers cover enough testing knowledge to pass a junior-level interview. This module covers why tests matter (regression safety, refactoring confidence, living documentation), the test pyramid at a basic level (unit vs integration vs end-to-end), RSpec syntax (describe, context, it, expect(x).to eq(y)), Minitest assertions (assert_equal, assert_nil, assert_raises, refute), how to run tests (rails test vs bundle exec rspec), model tests that verify validations and basic methods, controller tests that verify response status and redirects, fixtures vs FactoryBot (test data helpers), the test database (separate DB that resets between runs), and the red-green-refactor cycle. Every answer includes a minimal test example.
Full catalog
Topics are ordered for learning. Within each topic, rows are numbered 1–6 globally so you always know where you are. Collapse topics if you want a lighter view — use Expand all when you need the full list again.
Numbers 1–6 follow the order we recommend — click any row to open the full answer, or use the sticky Next link at the bottom of each page to go Q1 → Q6.