Bird
0
0

Which statement about RSpec matchers is true?

hard📝 Conceptual Q10 of 15
Ruby - Testing with RSpec and Minitest
Which statement about RSpec matchers is true?
A<code>eq</code> matcher checks for object identity (same object).
B<code>be</code> matcher checks for value equality.
C<code>match</code> matcher is used for regular expression matching.
D<code>include</code> matcher only works with arrays.
Step-by-Step Solution
Solution:
  1. Step 1: Understand each matcher

    eq checks value equality (==), not identity. be often checks identity (equal). match is for regex. include works with arrays, hashes, strings.
  2. Step 2: Identify the true statement

    Only the statement about match matcher being for regular expression matching is correct.
  3. Final Answer:

    match matcher is used for regular expression matching. -> Option C
  4. Quick Check:

    match = regex matcher [OK]
Quick Trick: Remember be checks identity, eq checks value [OK]
Common Mistakes:
  • Confusing eq and be matchers
  • Thinking include only works with arrays
  • Misunderstanding match purpose

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes