test/unit with shoulda

The have_many and allow_value methods are the same kind of matchers
seen in the RSpec example. They come from the shoulda-matchers gem.

Add shoulda to the project's Gemfile:

group:testdogem'shoulda'end

test/unit with shoulda-context

If you're not testing a Rails project or don't want to use the matchers,
you can use shoulda-context independently to write tests like:

classCalculatorTest<Test::Unit::TestCasecontext"a calculator"dosetupdo@calculator=Calculator.newendshould"add two numbers for the sum"doassert_equal4,@calculator.sum(2,2)endshould"multiply two numbers for the product"doassert_equal10,@calculator.product(2,5)endendend