Upgraded Rails and RSpec
[monkeycharger.git] / vendor / plugins / rspec / example_rails_app / config / boot.rb
blob479b7fdc2c4e0387bbb61dd8059554d0527d580b
1 # Don't change this file. Configuration is done in config/environment.rb and config/environments/*.rb
2 unless defined?(RAILS_ROOT)
3   root_path = File.join(File.dirname(__FILE__), '..')
5   unless RUBY_PLATFORM =~ /mswin32/
6     require 'pathname'
7     root_path = Pathname.new(root_path).cleanpath(true).to_s
8   end
10   RAILS_ROOT = root_path
11 end
13 ENV['RSPEC_RAILS_VERSION'] ||= "edge"
14 puts "running against rails #{ENV['RSPEC_RAILS_VERSION']}"
16 unless defined?(Rails::Initializer)
17   
18   version_root = File.expand_path("#{RAILS_ROOT}/vendor/rails/#{ENV['RSPEC_RAILS_VERSION']}")
19   if File.directory?(version_root)
20     $LOAD_PATH.unshift "#{version_root}/actionpack/lib/"
21     $LOAD_PATH.unshift "#{version_root}/actionmailer/lib/"
22     $LOAD_PATH.unshift "#{version_root}/actionwebservice/lib/"
23     $LOAD_PATH.unshift "#{version_root}/activerecord/lib/"
24     $LOAD_PATH.unshift "#{version_root}/activeresource/lib/"
25     $LOAD_PATH.unshift "#{version_root}/activesupport/lib/"
26     $LOAD_PATH.unshift "#{version_root}/railties/lib/"
27     require "#{version_root}/railties/lib/initializer"
28   else
29     raise "Attempting to run against rails #{version_root} but no such directory exists"
30     exit
31   end
33   Rails::Initializer.run(:set_load_path) do |config|
34     config.plugin_paths = File.expand_path("#{RAILS_ROOT}/../vendor/plugins")
35   end
36 end