1

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.

Ben Downey
  • 2,575
  • 4
  • 37
  • 57

1 Answers1

1

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

Danny
  • 5,945
  • 4
  • 32
  • 52