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 RSpec?
Questions in this quiz
What is RSpec?
What is the relationship between RSpec and Ruby on Rails testing, particularly regarding tools like FactoryBot?
What is "shared examples" in RSpec, and what problem does it solve?
What is a `verifying double` (like `instance_double(User)`) in RSpec, and how does it differ from a plain `double`?
What does `expect(array).to include(item)` check in RSpec?
What does `expect { fn.call }.to raise_error(SomeError)` check in RSpec?
What is an RSpec "let" (as in `let(:user) { User.new(name: "Ada") }`), and how does it differ from an instance variable set in a `before` block?
What is `described_class` in an RSpec spec, when used inside a `describe SomeClass do ... end` block?
What does `allow(object).to receive(:method_name).and_return(value)` do in RSpec?
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(value).to be_truthy` check, versus `expect(value).to eq(true)`?
What is RSpec's "expect" syntax (`expect(x).to matcher`), and how does it differ from the older "should" syntax (`x.should matcher`)?