Undefined method: assert_not_nil in Minitest

Viewed 7505

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.

4 Answers

assert !!result has worked for me. !! means "convert to boolean" (literally double negation).

Related