vendredi 16 août 2019

Rails-style test method in plain Ruby with just Minitest?

Rails adds a test method enabling one to write:

class FooTest < ActiveSupport::TestCase

  test "the truth" do
    assert true
  end

end

How might one enable the identical expressiveness in a plain Ruby test suite with only Minitest? Instead of:

class FooTest

  def test_the_truth
    assert true
  end

end

or "spec-style" like:

describe Foo
  it "is true" do
    assert true
  end
end

I'd like to be able to:

class FooTest

  test "the truth" do
    assert true
  end

end

Or use test instead of it in the "spec-style."

Aucun commentaire:

Enregistrer un commentaire