require files

How to I handle loading files with relative path?

For example:

require ‘…/spec_helper.rb’

require ‘/home/user/myapp/spec/spec_helper.rb’

Thanks!

Alex

This is a commonly used convention:

How to I handle loading files with relative path?

For example:

require '../spec_helper.rb'

require '/home/user/myapp/spec/spec_helper.rb'

assuming this is in the context of rspec, with the current version just require 'spec_helper' will do (because rspec sticks the spec folder into the load path)

Fred

Thanks so much! The require_relative is much cleaner. 1.9 works for me.

This worked too. Even better. Thanks!

This worked too. Even better. Thanks!