3 ms·
I still don’t get how it "adds two numbers" do calc = Calculator.new expect(calc.add(2, 3)).to eq(5) end is supposed to be more readable than t
by xigoi 1y ago
I still don’t get how
it "adds two numbers" do
calc = Calculator.new
expect(calc.add(2, 3)).to eq(5)
end
is supposed to be more readable than
test "add two numbers":
let calc = Calculator.new
check calc.add(2, 3) == 5
(The latter is Nim with the std/unittest module.)
- Alifatisk 1y agoYour example is Rspec, a testing framework for Ruby, not everyone enjoys it Here's with Minitest (part of std) it "adds two numbers" do calc = Calculator.new assert_equal 5, calc.add(2, 3) end If you want even closer to yours, the following works just fine assert calc.add(2, 3) == 5 Better?