From: Jarmo Pertman Date: 2010-07-28T01:47:08+09:00 Subject: Re: Typical Ruby (non-rails) project structure. On Jul 23, 9:28 pm, Carl Jenkins wrote: > In order to test the new_file.rb my new_test.rb must have the path to > the new_file.rb as the require correct? Something like require > '../lib/common/new_file' > > Or is there a different way to do that? > > Thanks for all the help - (everyone) this is most helpful! I would play with the $LOAD_PATH in your spec_helper or whatnot: # spec_helper.rb $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "../lib")) # blah_spec.rb require "spec_helper" # require in every spec file require "my_class" # now it's possible to require my_class from lib dir because of changed $LOAD_PATH describe MyClass do it "test, test, test!" do MyClass.new.should be end end Or, if using really RSpec, then create a spec.opts file into the spec directory and require it from there: --require spec_helper Then you can remove those require statements from spec files themselves. Although if you're using some kind of an IDE, then they might get confused, but i don't mind :) ----- Jarmo Pertman IT does really matter - http://www.itreallymatters.net