aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/shared_helpers.rb
diff options
context:
space:
mode:
authorSarah Allen <sarah@ultrasaurus.com>2010-10-24 09:25:31 -0700
committerAndre Arko <andre@arko.net>2010-10-24 18:29:03 -0700
commit3735dda8a4bf5a8606d3b2f248c35f052da564a8 (patch)
treeab96c4a9971eff26fa1d6d4438f9a892fbb0a4e6 /lib/bundler/shared_helpers.rb
parentfefc3340d3c31e25bdf6e6db5918e7122478795f (diff)
downloadbundler-3735dda8a4bf5a8606d3b2f248c35f052da564a8.tar.gz
make sure we don't accidentally find a Gemfile outside of source dir when testing
Closes #792 Closes #795
Diffstat (limited to 'lib/bundler/shared_helpers.rb')
-rw-r--r--lib/bundler/shared_helpers.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index 79f72117..dfef3cdc 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -39,6 +39,10 @@ module Bundler
current = File.expand_path(Dir.pwd)
until !File.directory?(current) || current == previous
+ # avoid stepping above the tmp directory when testing
+ return nil if File.file?(File.join(current, 'bundler.gemspec'))
+
+ # otherwise return the Gemfile if it's there
filename = File.join(current, 'Gemfile')
return filename if File.file?(filename)
current, previous = File.expand_path("..", current), current