I added several modules and put them in the / lib directory, and I think the lib directory is loaded magically with Rails (unless I loaded the lib directory somewhere at the beginning of my project and forgot about it). However, when I run unit tests that require my additional modules, they do not load.
Should the lib directory load automatically when running the tests, or is there an elegant way to do this for testing? I was hoping that the rake + Test :: Unit scripts would load the Rails environment exactly, but that doesn't seem to be the case. I just have to do something like test_helper.rb:
require File.expand_path(File.dirname(__FILE__) + "/../lib/foo")
I run my tests with standard rake scripts, for example:
rake test
rake test:units
rake test:functionals
source
share