RSpec/SpecFilePathFormat cop is far too permissive when it comes to namespace/postfix discrepencies in spec files.
Steps to reproduce the problem
Configure rubocop-rspec
RSpec/SpecFilePathFormat:
Enabled: true
Set up a vanilla Rails project with at least a single model, say User.
Set up a completely wrong spec file
# in spec/models/random/userx_spec.rb
RSpec.describe User, type: :model do
end
Expected behavior
File is flagged as invalid, saying its placement and naming imply Random::Userx class to be specced, but User is being specced.
Actual behavior
No offence is reported.
RuboCop RSpec version
$ [bundle exec] rubocop -V
rubocop -V
1.86.0 (using Parser 3.3.10.2, Prism 1.9.0, parser_prism, rubocop-ast 1.49.1, analyzing as Ruby 3.4, running on ruby 3.4.8) [arm64-darwin23]
- rubocop-capybara 2.22.1
- rubocop-factory_bot 2.28.0
- rubocop-rails 2.34.3
- rubocop-rspec 3.8.0
- rubocop-rspec_rails 2.32.0
RSpec/SpecFilePathFormatcop is far too permissive when it comes to namespace/postfix discrepencies in spec files.Steps to reproduce the problem
Configure rubocop-rspec
Set up a vanilla Rails project with at least a single model, say User.
Set up a completely wrong spec file
Expected behavior
File is flagged as invalid, saying its placement and naming imply
Random::Userxclass to be specced, butUseris being specced.Actual behavior
No offence is reported.
RuboCop RSpec version