# This is based on Florian Weber's TDDMate

ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
rspec_rails_plugin = File.join(ENV['TM_PROJECT_DIRECTORY'],'vendor','plugins','rspec','lib')

if File.exist?(File.join(ENV['TM_PROJECT_DIRECTORY'], 'Gemfile'))
  require "rubygems"
  require "bundler"
  Bundler.setup
elsif File.directory?(rspec_rails_plugin)
  $LOAD_PATH.unshift(rspec_rails_plugin)
elsif ENV['TM_RSPEC_HOME']
  rspec_lib = File.join(ENV['TM_RSPEC_HOME'], 'lib')
  unless File.directory?(rspec_lib)
    raise "TM_RSPEC_HOME points to a bad location: #{ENV['TM_RSPEC_HOME']}"
  end
  $LOAD_PATH.unshift(rspec_lib)
end

begin
  require 'spec/autorun'
rescue LoadError
  require 'rspec/core'
end

def rspec2?
  defined?(RSpec)
end

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/..')
require 'spec/mate/runner'
require 'spec/mate/switch_command'

# This is based on Florian Weber's TDDMate

ENV['TM_PROJECT_DIRECTORY'] ||= File.dirname(ENV['TM_FILEPATH'])
rspec_rails_plugin = File.join(ENV['TM_PROJECT_DIRECTORY'],'vendor','plugins','rspec','lib')

if File.exist?(File.join(ENV['TM_PROJECT_DIRECTORY'], 'Gemfile'))
  require "rubygems"
  require "bundler"
  Bundler.setup
elsif File.directory?(rspec_rails_plugin)
  $LOAD_PATH.unshift(rspec_rails_plugin)
elsif ENV['TM_RSPEC_HOME']
  rspec_lib = File.join(ENV['TM_RSPEC_HOME'], 'lib')
  unless File.directory?(rspec_lib)
    raise "TM_RSPEC_HOME points to a bad location: #{ENV['TM_RSPEC_HOME']}"
  end
  $LOAD_PATH.unshift(rspec_lib)
end

begin
  require 'spec/autorun'
rescue LoadError
  require 'rspec/core'
  ENV['DISABLE_RSPEC_AUTORUN'] = "true"
end

def rspec2?
  defined?(RSpec)
end

$LOAD_PATH.unshift(File.dirname(__FILE__) + '/..')
require 'spec/mate/runner'
require 'spec/mate/switch_command'

Disable rspec autorun for rspec 2
Disable rspec autorun for rspec 2
