Observe ruby namespaces in file structure more consistently
Summary
Moving around our codebase we have some places where the mapping from ruby namespace to filesystem namespace for both the code and the tests is not well observed, leading to occasional headscratching as to what code lives where.
Example: lib/gitlab/build.rb defines the namespace Build and is tested by spec/gitlab/build_spec.rb.
Either of the following would make more sense to me:
| Namespace | File | Tests |
|---|---|---|
Build |
lib/build.rb |
spec/lib/build_spec.rb |
Gitlab::Build |
lib/gitlab/build.rb |
spec/lib/gitlab/build_spec.rb |
On spec/lib - we would want to introduce another namespace just to keep our organisation of rspec tests neat. I see that gitlab-ee uses spec/lib alongside spec/models for this, which is a good analogue to our existing splitting out of spec/chef/recipes and spec/chef/resources.
Proposal
- Decide on the code/test organisation that makes the most sense
- Move things around, fix tests and other breaks
Potential downsides
- As it's a code rearrangement, there's the slight headache of conflicts with other MRs in flight
- We have too much muscle-memory for the existing layout
Edited by Richard Clamp