Hi Marcelo
Thanks for bringing this to the mailing list, unfortunately thats something we wouldn’t be interested in adding to rspec-rails, for a couple of reasons.
The main reason being we don’t support 3rd party libraries other than Rails own dependencies directly within rspec-rails, given the size of the rails eco system this would lead to massive feature bloat on our part, we prefer to provide the tools for other gems to hook into us, even if it’s just with a `rspec-view_component` style gem etc.
We also consider `infer_spec_type_from_file_location!` to be a legacy feature for older rails test suites so don’t want to encourage further adoption (we’d like to deprecate it and remove it one day).
However you can add the type yourself to get the functionality you want, rspec-rails uses the public rspec api’s to do this like so:
RSpec.configure do |c|
c.define_derived_metadata(file_path: /spec[\\\/]components[\\\/]/) do |metadata|
metadata[:type] ||= :component
end
end
This would be added to your spec helper and should allow you to not have to declare the component type manually, you could even suggest it to the view_component authors as part of any test helpers they have.
Cheers
Jon
----------------