0

I have some classes in app/custom

In /custom I have a bunch of other folders with classes. From the app I only use app/custom/*rb but for testing purposes I would want to directly access all subfolders and their classes. Is this possible? I realise Rspec likes to look in the typical directories for its testing, but I need this directory to be loaded.

Thanks

David Sigley
  • 1,126
  • 2
  • 13
  • 28

1 Answers1

0

Could you just require all the needed files in your spec_helper.rb? Something like this might work:

Dir[File.join('custom', '**', '*.rb')].each {|f| require_relative f}

or

Dir[Rails.root.join('custom', '**', '*.rb')].each {|f| require f}

Ideas for that code found in this SO question.

James Milani
  • 1,921
  • 2
  • 16
  • 26