diff options
author | Carl Lerche <carllerche@mac.com> | 2009-10-14 16:13:45 -0700 |
---|---|---|
committer | Carl Lerche <carllerche@mac.com> | 2009-10-14 16:40:25 -0700 |
commit | bf9819f73d74e19052b7b8a7a9885972a27e8876 (patch) | |
tree | 05a1acddbcfa4f697b8f7af1685055104017d344 /railties/test/application | |
parent | 00eb09e016837e361fb9dcf6a46d1715ec59beca (diff) | |
download | rails-bf9819f73d74e19052b7b8a7a9885972a27e8876.tar.gz rails-bf9819f73d74e19052b7b8a7a9885972a27e8876.tar.bz2 rails-bf9819f73d74e19052b7b8a7a9885972a27e8876.zip |
Have Rails.root be based off of config.ru
Diffstat (limited to 'railties/test/application')
-rw-r--r-- | railties/test/application/configuration_test.rb | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 1bf59c2b8e..d90582d3db 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -7,11 +7,43 @@ module ApplicationTests def setup build_app boot_rails + Object.send(:remove_const, :RAILS_ROOT) end test "the application root is set correctly" do - # require "#{app_path}/config/environment" - # assert_equal app_path, Rails.application.root + require "#{app_path}/config/environment" + assert_equal app_path, Rails.application.root + end + + test "the application root can be set" do + FileUtils.mkdir_p("#{app_path}/hello") + add_to_config <<-RUBY + config.frameworks = [] + config.root = '#{app_path}/hello' + RUBY + require "#{app_path}/config/environment" + assert_equal "#{app_path}/hello", Rails.application.root + end + + test "the application root is detected as where config.ru is located" do + add_to_config <<-RUBY + config.frameworks = [] + RUBY + FileUtils.mv "#{app_path}/config.ru", "#{app_path}/config/config.ru" + require "#{app_path}/config/environment" + assert_equal "#{app_path}/config", Rails.application.root + end + + test "the application root is Dir.pwd if there is no config.ru" do + File.delete("#{app_path}/config.ru") + add_to_config <<-RUBY + config.frameworks = [] + RUBY + + Dir.chdir("#{app_path}/app") do + require "#{app_path}/config/environment" + assert_equal "#{app_path}/app", Rails.application.root + end end end end
\ No newline at end of file |