Minitest basics (assert style)
📖 Scenario: You are learning how to write simple tests in Ruby using Minitest. Testing helps you check if your code works as expected, like checking if a calculator adds numbers correctly.
🎯 Goal: Build a small Ruby test file using Minitest with assert style to check if a method returns the correct sum of two numbers.
📋 What You'll Learn
Create a method called
add that takes two numbers and returns their sumWrite a Minitest test class called
TestAddInside the test class, write a test method called
test_additionUse
assert_equal to check if add(2, 3) returns 5Run the test and print the result
💡 Why This Matters
🌍 Real World
Testing code helps catch mistakes early, just like checking your homework before submitting it.
💼 Career
Many software jobs require writing tests to ensure code quality and prevent bugs.
Progress0 / 4 steps