Ruby on Rails ·

undefined method `assert_no_difference’ and `assert_difference’

I’ve been upgrading some old code and noticed that my unit tests started spitting out a lot of errors like this:


undefined method `assert_no_difference'
</pre>

and


undefined method `assert_difference'
</pre>

It turns out that I needed to change my base classes from <strong>Test::Unit::TestCase</strong> to <strong>ActiveSupport::TestCase</strong>:


class UserTest < Test::Unit::TestCase
  # stuff
end
</pre>

<p>changes to:</p>


class UserTest < ActiveSupport::TestCase
  # stuff
end
</pre>