What Ruby, Rails and RSpec versions are you using?
Ruby version: 3.0.3
Rails version: 7.0.3.1
RSpec version: 6.0.0
Observed behaviour
We had a helper spec start to fail when attempting to upgrade rspec-rails to v6.0.0. While debugging to figure out why it was just the one helper spec that failed (while many others continued passing), I figured out the issue had to do with the helper in question defining a method called #name. We usually name our subjects after the method they're testing. In this case, switching to an unnamed subject caused a different error: it turned out there are two separate issues.
When using subject(:name)
NoMethodError: undefined method `view_context' for nil:NilClass
When defining a #name helper with at least one argument
ArgumentError: wrong number of arguments (given 0, expected 1)
This breaks all specs in the file, not just the specs for #name
Expected behaviour
The specs in the example app should all pass.
Can you provide an example app?
https://github.com/magni-/rspec-rails-dummy