Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.)


Your 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?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: