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" in
rails-3.0.pre/test/configuration_test.rb was the culprit. The test
removed the file from the tmp/app to test that it makes the
Rails.root equal Dir.pwd.

It found my 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 for MY_RAILS_PROJ for the
test suite to run successfully.

I'm wondring why this while loop exists in the root method in

        while root_path && && !File.exist?
          parent = File.dirname(root_path)
          root_path = parent != root_path && parent

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