From: James Herdman Date: 2006-03-25T13:43:55+09:00 Subject: Regarding Testing Mixins How does one write a unit test for a mixin? I gathered since our unit test is a class (TestClassName < Test::Unit::TestCase), we could just include said module into said class. However, I've ran into a problem. Suppose my project directory is as follows: ../project_dir/trunk/lib # Where all my classes and scripts go ../project_dir/trunk/tests # Where all my tests go My mixin resides in the lib folder, and normally I use this neat trick to handle this discreprancy in file locations: $:.unshift File.join(File.dirname(__FILE__), "..", "lib") # Thank you Pick Ax! Why doesn't this seem to work for mixins? Where does Ruby look for mixins? I'm assuming it's a path problem despite the fact that Ruby groans that the name I'm providing it is an unitialized constant (e.g. include Mixin -- if I write include "Mixin", Ruby tells me "wrong argument type String (expected Module)") Thank you, James Herdman