EE spec locations are inconsistent
Background
@dstull noticed in !26296 (comment 298966967)
that we have specs for the same class in two locations ee/spec/lib/gitlab/usage_data_spec.rb
and ee/spec/lib/ee/gitlab/usage_data_spec.rb
with different contents...
Proposal
We should establish this pattern:
If a spec is describe Gitlab::UsageData
, then it should go into ee/spec/lib/gitlab/usage_data_spec.rb
.
Conversely if a spec is describe EE::Gitlab::UsageData
, then it should go into ee/spec/lib/ee/gitlab/usage_data_spec.rb
.
Further details
This is currently half-enforced by RSpec/FilePath
, in that describe EE::Gitlab::UsageData
inside ee/spec/lib/gitlab/usage_data_spec.rb
is caught but not describe Gitlab::UsageData
inside ee/spec/lib/ee/gitlab/usage_data_spec.rb
. (see https://github.com/rubocop-hq/rubocop-rspec/blob/7970b192bf55992b8d29f60d52a14ac32fcf5678/spec/rubocop/cop/rspec/file_path_spec.rb#L81-L85, thanks @smcgivern!)
We should also have a cop to enforce that the pattern of describe Gitlab::UsageData
is not allowed in ee/spec/lib/ee/gitlab/usage_data_spec.rb
.
Links
- https://gitlab.slack.com/archives/C8HG8D9MY/p1583360204118300 (internal Slack thread)