rubocop-rspec icon indicating copy to clipboard operation
rubocop-rspec copied to clipboard

`FilePath` rule option to ignore module?

Open mockdeep opened this issue 6 years ago • 4 comments

I sometimes like to use a top-level application module to namespace internal stuff for clarity, but I don't really want to have to nest my specs under that directory. It would be nice if there was some option to allow ignoring certain modules when resolving the path. For example:

# class
module MyApp
  module Matchers
    class HaveTask
      # code here
    end
  end
end

# spec
describe MyApp::Matchers::HaveTask do
  # tests here
end

For the above class HaveTask, I would want to have the spec file in spec/matchers/have_task_spec.rb, but the FilePath rule requires that it goes under spec/my_app/matchers/have_task_spec.rb.

mockdeep avatar Dec 28 '17 21:12 mockdeep