From 22e5ab31b52a287705083ad6f3cad836ab96b619 Mon Sep 17 00:00:00 2001 From: Prathamesh Sonpatki Date: Wed, 10 Apr 2013 08:33:05 +0530 Subject: Searching for rails executable correctly * Current logic of finding Rails executable in parent directory is not returning full path of executable if it is found in one of the parent directories * To compensate for this, we have to call exec_app_rails recursively until the executable is found or we cant do 'chdir' anymore * This solution finds the correct executable path from parent directory(s) recursively --- railties/test/app_rails_loader_test.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'railties/test') diff --git a/railties/test/app_rails_loader_test.rb b/railties/test/app_rails_loader_test.rb index 63ed9eaef0..0402989705 100644 --- a/railties/test/app_rails_loader_test.rb +++ b/railties/test/app_rails_loader_test.rb @@ -17,14 +17,14 @@ class AppRailsLoaderTest < ActiveSupport::TestCase test "is not in a rails application if #{exe} exists but doesn't contain APP_PATH" do File.stubs(:exists?).with(exe).returns(true) File.stubs(:read).with(exe).returns("railties #{exe}") - assert !Rails::AppRailsLoader.find_executable + assert !Rails::AppRailsLoader.exec_app_rails end test "is in a rails application if parent directory has #{exe} containing APP_PATH" do File.stubs(:exists?).with("/foo/bar/#{exe}").returns(false) File.stubs(:exists?).with("/foo/#{exe}").returns(true) File.stubs(:read).with("/foo/#{exe}").returns('APP_PATH') - assert Rails::AppRailsLoader.find_executable_in_parent_path(Pathname.new("/foo/bar")) + assert_equal Rails::AppRailsLoader.find_executable_in_parent_path(Pathname.new("/foo/bar")), "/foo/#{exe}" end test "is not in a rails application if at the root directory and doesn't have #{exe}" do @@ -36,7 +36,7 @@ class AppRailsLoaderTest < ActiveSupport::TestCase File.stubs(:exists?).with("/foo/bar/#{exe}").returns(false) File.stubs(:exists?).with("/foo/#{exe}").returns(true) File.stubs(:read).with("/foo/#{exe}").returns('ENGINE_PATH') - assert Rails::AppRailsLoader.find_executable_in_parent_path(Pathname.new("/foo/bar")) + assert Rails::AppRailsLoader.find_executable_in_parent_path(Pathname.new("/foo/bar")), "/foo/#{exe}" end test "is in a rails engine if #{exe} exists containing ENGINE_PATH" do -- cgit v1.2.3