I have a class defined in a file my Rails project’s lib dir that will implement a bunch of utility functions as class methods. I’d like to write tests against those methods using Test::Unit and have them run as part of the project’s regular testing routine.
I tried sticking a file at the top level of the test dir…
require 'test_helper' class UtilsTest < ActiveSupport::TestCase should 'be true' do assert false end end
…but that didn’t work. The test didn’t run.
What is the normal way to test code that is not one of the regular parts of Rails?
You can put them in your units directory without any complications.
My Library:
My Test:
And running it:
As long as it ends in _test.rb it should pick it up.