You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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