Skip to content

Instantly share code, notes, and snippets.

@aalin
Forked from henrik/find_closest_spec_helper.rb
Created April 8, 2010 12:32
Show Gist options
  • Save aalin/360038 to your computer and use it in GitHub Desktop.
Save aalin/360038 to your computer and use it in GitHub Desktop.
def find_spec_helper(path)
spec_helper = File.join(path, 'spec_helper.rb')
if File.exists?(spec_helper)
spec_helper
elsif path == "/"
raise "No spec helper found"
else
find_spec_helper(File.dirname(path))
end
end
root = '/Users/henrik/Sites/auktion/spec/models/auction'
puts find_spec_helper(root)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment