Issue with how Rails finds its root

Hey guys,

I wanted to ask about how Rails 3 finds it root 'cause of some issues
I had on a project earlier.

I was trying to test Rails with Rake. Rails is being stored in
"MY_RAILS_PROJ/vendor/gems/gems/rails-3.0.pre." I had a test failing
because it was setting the application root to MY_RAILS_PROJ instead
of MY_RAILS_PROJ/vendor/gems/gems/rails-3.0.pre/tmp/app which is where
it should've set the application to.

The test "the application root is Dir.pwd if there is no config.ru" in
rails-3.0.pre/test/configuration_test.rb was the culprit. The test
removed the config.ru file from the tmp/app to test that it makes the
Rails.root equal Dir.pwd.

It found my config.ru though, the one for MY_RAILS_PROJ.
Unfortunately, now if I want to test my updates to Rails as I work on
my project, I have to remove my config.ru for MY_RAILS_PROJ for the
test suite to run successfully.

I'm wondring why this while loop exists in the root method in
configuration.rb:

        while root_path && File.directory?(root_path) && !File.exist?
("#{root_path}/config.ru")
          parent = File.dirname(root_path)
          root_path = parent != root_path && parent
        end

According to configuration_test.rb, it's so that config.ru can be
detected from both RAILS_ROOT/config/config.ru and RAILS_ROOT/
config.ru, which is understandable. But should the loop be allowed to
check outside of the presumed RAILS_ROOT? And if so, why?