Created
June 1, 2012 10:51
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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