Test your RSpec knowledge with a free interactive quiz — 20 questions with answers and explanations. No signup needed to play.
Question 1/12Score 0
What is RSpec's "expect" syntax (`expect(x).to matcher`), and how does it differ from the older "should" syntax (`x.should matcher`)?
In this round
What is RSpec's "expect" syntax (`expect(x).to matcher`), and how does it differ from the older "should" syntax (`x.should matcher`)?
What is a `verifying double` (like `instance_double(User)`) in RSpec, and how does it differ from a plain `double`?
What is the purpose of `before(:each)` (or simply `before`) and `after(:each)` in an RSpec spec file?
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 does `allow(object).to receive(:method_name).and_return(value)` do in RSpec?
What does `expect(array).to include(item)` check in RSpec?
What is a "context" block in RSpec, and how does it differ from `describe`?
What is `described_class` in an RSpec spec, when used inside a `describe SomeClass do ... end` block?
What do `describe` and `it` do in an RSpec spec file?
What is "shared examples" in RSpec, and what problem does it solve?
What does `expect { fn.call }.to raise_error(SomeError)` check in RSpec?
What does `expect(value).to be_truthy` check, versus `expect(value).to eq(true)`?