Skip to content

Instantly share code, notes, and snippets.

@jens
Forked from henrik/find_closest_spec_helper.rb
Created April 8, 2010 13:25
Show Gist options
  • Save jens/360065 to your computer and use it in GitHub Desktop.
Save jens/360065 to your computer and use it in GitHub Desktop.
root = '/Users/henrik/Sites/auktion/spec/models/auction'
max = root.scan('/').length + 1
x = max.times { |i|
path = "#{root}/#{'../'*i}spec_helper.rb"
unless (found = Dir[path]).empty?
break(File.expand_path(found.first))
end
}
p x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment