mercredi 30 août 2017

Using Zeus for Rails auto-reloading, how do I include classes in extra subfolders?

I'm working on a large Rails 3.2 project. I use Zeus (and sometimes Guard) to auto reload rails so the tests run faster. However, when running certain tests, I get uninitialized constant errors.

It appears that Zeus doesn't like the fact that I've added some subfolders for organizational purposes.

To be specific, under app/models I added a devices subfolder and under that I have other folders that correspond to the namespace of a device.

For example, I might have: app/models/devices/amazon/alexa.rb which would contain the class: Amazon::Alexa. (not an actual example, but indicative of the naming and folder constructs).

I've added the app/models/devices folder to the load path in application.rb:

config.autoload_paths += [ Rails.root.join("app", "models", "devices") ]

This works when I run the Rails app. It also works if I run the specs directly (rspec ...)

But it fails to load constants when I run via Zeus or Guard.

Any suggestions on how to properly configure Zeus/Guard or Rails/Rspec so the load path works and the classes & constants are loaded correctly?

Thanks!

Aucun commentaire:

Enregistrer un commentaire