Bird
0
0

You want to add a new feature to a Ruby class using TDD. Which sequence correctly follows the TDD workflow?

hard📝 Application Q8 of 15
Ruby - Testing with RSpec and Minitest
You want to add a new feature to a Ruby class using TDD. Which sequence correctly follows the TDD workflow?
ARefactor code, write test, write code
BWrite a failing test, write code to pass test, refactor code
CWrite code, write test, run test
DRun tests, write code, write test
Step-by-Step Solution
Solution:
  1. Step 1: Recall the TDD cycle steps

    TDD starts with writing a failing test to define behavior, then code to pass it, then refactor.
  2. Step 2: Match the sequence with the options

    Write a failing test, write code to pass test, refactor code correctly lists write failing test, write code, then refactor.
  3. Final Answer:

    Write a failing test, write code to pass test, refactor code -> Option B
  4. Quick Check:

    TDD cycle = Fail test, pass code, refactor [OK]
Quick Trick: TDD = Fail test, pass code, refactor [OK]
Common Mistakes:
  • Writing code before tests
  • Refactoring before passing tests
  • Running tests without writing them first

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes