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
What is an RSpec "double" (or "test double"), created via `double("User")`?
What is RSpec?
What is RSpec's "expect" syntax (`expect(x).to matcher`), and how does it differ from the older "should" syntax (`x.should matcher`)?
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?
What does `expect(array).to include(item)` check in RSpec?
What is the purpose of `before(:each)` (or simply `before`) and `after(:each)` in an RSpec spec file?
What is a `verifying double` (like `instance_double(User)`) in RSpec, and how does it differ from a plain `double`?
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?
What is a "matcher" in RSpec (like `eq`, `include`, `be_truthy`, `raise_error`)?
What does `expect(value).to be_truthy` check, versus `expect(value).to eq(true)`?
What is "shared examples" in RSpec, and what problem does it solve?
What does `allow(object).to receive(:method_name).and_return(value)` do in RSpec?