All quizzes
Free quiz · 20 questions in the bank

RSpec quiz

Test your RSpec knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.

Question 1/5Score 0

What is an RSpec "double" (or "test double"), created via `double("User")`?

Questions in this quiz
  1. What is an RSpec "double" (or "test double"), created via `double("User")`?
  2. What is RSpec?
  3. What is RSpec's "expect" syntax (`expect(x).to matcher`), and how does it differ from the older "should" syntax (`x.should matcher`)?
  4. Why might a team prefer `expect(object).to have_received(:method_name)` (used after configuring a spy via `allow`) over `expect(object).to receive(:method_name)` set up BEFORE the action under test runs?
  5. What does `expect(array).to include(item)` check in RSpec?
  6. What is the purpose of `before(:each)` (or simply `before`) and `after(:each)` in an RSpec spec file?
  7. What is a `verifying double` (like `instance_double(User)`) in RSpec, and how does it differ from a plain `double`?
  8. What is a general criticism sometimes raised about RSpec's highly expressive, English-like DSL syntax compared to a more plain, code-based testing framework like Minitest?
  9. What is a "matcher" in RSpec (like `eq`, `include`, `be_truthy`, `raise_error`)?
  10. What does `expect(value).to be_truthy` check, versus `expect(value).to eq(true)`?
  11. What is "shared examples" in RSpec, and what problem does it solve?
  12. What does `allow(object).to receive(:method_name).and_return(value)` do in RSpec?
Gaps to close?
Read the curated RSpec notes — core concepts, patterns, interview prep.
RSpec notes

More quizzes

.NET.NET MAUIAbsintheAccessibilityActixActix Web