I opened irb & entered:
require 'test/unit'
but when I used the assert_equal
method, I got following error: NoMethodError: undefined method 'assert_equal' for main:Object
. Why is this happening even after requiring 'test/unit' ?
assert_equal
is defined on subclasses of Test::Unit::TestCase
, so are only available in that class. You may have some success with include Test::Unit::TestCase
to load those methods onto the current scope.
More likely you could be better writing your tests in a short file, and running them with ruby ./my_file.rb