module Rspec::Core::RubyProject

def add_to_load_path(dir)

def add_to_load_path(dir)
  dir = File.join(root, dir)
  $LOAD_PATH.unshift(dir) unless $LOAD_PATH.include?(dir)
end

def determine_root # :nodoc:

:nodoc:
def determine_root # :nodoc:
  # This is borrowed (slightly modified) from Scott Taylor's
  # project_path project:
  #   http://github.com/smtlaissezfaire/project_path
  Pathname(File.expand_path('.')).ascend do |path|
    if File.exists?(File.join(path, "spec"))
      return path
    end
  end
end

def root # :nodoc:

:nodoc:
def root # :nodoc:
  require 'pathname'
  @project_root ||= determine_root
end