Your code example will end in a NameError: uninitialized constant Minitest
.
You have two possibilities:
- Use
test/unit
in combination with Test::Unit::TestCase
or
- use
require 'minitest/autorun'
in combination with Minitest::Test
.
test/unit
is deprecated and it is recommended to use minitest (MiniTest is faster and smaller).
If you switch the test gem you must change perhaps some more things:
- replace
require "test/unit"
with require "minitest/autorun"
- replace
Test::Unit::TestCase with
with Minitest::Test
- There is no
assert_nothing_raised
(details)
assert_raise
becomes assert_raises
.
- perhaps some other issues
You may use require 'minitest'
instead require 'minitest/autorun'
- you will get no syntax error, but there is also no test execution. If you want to execute tests, you must call them on your own (see minitest-a-test-suite-with-method-level-granularity)