Skip to content

Instantly share code, notes, and snippets.

@Sam-Serpoosh
Created June 1, 2012 10:51
Show Gist options
  • Save Sam-Serpoosh/2851135 to your computer and use it in GitHub Desktop.
Save Sam-Serpoosh/2851135 to your computer and use it in GitHub Desktop.
a handy method for requiring all ruby files in a folder which is in rails app folder (like controllers, views, helpers, etc.) really useful in rails specs (for me at least). it can be in a spec_helper_lite file in spec folder.
def require_folder(folder_name_in_app)
Dir[File.expand_path(File.dirname(__FILE__) + "/../app/" + folder_name_in_app + "/*.rb"].each { |file| require file }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment