Reputation: 2665
I'm extracting functionality into a rails app and I'm wondering what the best practice is for moving the specs over.
Should the specs be in a special namespaced directory?
specs/my_engine
The controllers and models exist within the correct namespace (i.e. engine's name), but I'm not sure what to do about the specs.
Upvotes: 1
Views: 137
Reputation: 6025
I would suggest to organize your specs in
specs/controllers/xxx_controller_spec.rb
specs/controllers/yyy_controller_spec.rb
specs/controllers/zzz_controller_spec.rb
then do the same for your models
specs/models/xxx_spec.rb
specs/models/yyy_spec.rb
specs/models/zzz_spec.rb
If you use factories, just another directory
specs/factories/xxx.rb
and so on.
If you have additional name spaces, copy the same structure in your rspec directories.
This keeps things well organized and structured, and you have a structure "mirroring" your implementation
Upvotes: 1