diff options
author | José Valim <jose.valim@gmail.com> | 2009-11-03 00:08:33 -0200 |
---|---|---|
committer | Engine Yard <engineyard@Engine-Yards-MacBook-Pro.local> | 2009-11-02 18:20:16 -0800 |
commit | d226f17507805c145cc7a1727d46714b88910094 (patch) | |
tree | 5fd52e0715c9d6c8f10b7a9ac9db1fa066a65eb0 /railties/test/generators/generators_test_helper.rb | |
parent | 23780850237876cf81038534d8f59fa307af0b31 (diff) | |
download | rails-d226f17507805c145cc7a1727d46714b88910094.tar.gz rails-d226f17507805c145cc7a1727d46714b88910094.tar.bz2 rails-d226f17507805c145cc7a1727d46714b88910094.zip |
Ensure that generators can be invoked from any directory.
Signed-off-by: Engine Yard <engineyard@Engine-Yards-MacBook-Pro.local>
Diffstat (limited to 'railties/test/generators/generators_test_helper.rb')
-rw-r--r-- | railties/test/generators/generators_test_helper.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/railties/test/generators/generators_test_helper.rb b/railties/test/generators/generators_test_helper.rb index ccf08c347c..fdf6b4041f 100644 --- a/railties/test/generators/generators_test_helper.rb +++ b/railties/test/generators/generators_test_helper.rb @@ -1,8 +1,14 @@ # TODO: Fix this RAILS_ENV stuff -RAILS_ENV = 'test' - +RAILS_ENV = 'test' unless defined?(RAILS_ENV) require 'abstract_unit' -Rails.application.config.root = File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures')) + +module Rails + def self.root + @root ||= File.expand_path(File.join(File.dirname(__FILE__), '..', 'fixtures')) + end +end +Rails.application.config.root = Rails.root + require 'rails/generators' require 'rubygems' require 'active_record' @@ -15,8 +21,7 @@ class GeneratorsTestCase < Test::Unit::TestCase include FileUtils def destination_root - @destination_root ||= File.expand_path(File.join(File.dirname(__FILE__), - '..', 'fixtures', 'tmp')) + File.join(Rails.root, "tmp") end def setup |