I'm trying to execute the following code, but it is giving me an undefined method error:
require 'minitest/autorun'
require 'string_extension'
class StringExtensionTest < Minitest::Test
def test_humanize_returns_nothing
assert_not_nil "Yo".humanize, "humanize is returning nil."
end
end
I'm trying to execute this code from Codeschool's Rails course, but it seems that there is no method assert_not_nil
. I've also checked the documentation for MiniTest framework, and neither it is defined there, but I'm not sure.
Here you can find the list of assertions defined by MiniTest
.
As you can see, assert_not_nil
is not defined. There's a lot of possible assertions that MiniTest
doesn't define, but it's also true that any assertion can be defined with the simplest assertion ever possible assert
.
In your specific case:
assert result != nil
You can also pass a custom message
assert result != nil, "Expected something to not be nil"