-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v6.0.0 breaks if a helper spec subject is named name
or if a helper module defines a #name
method with arguments
#2624
Comments
Oh I was wrong |
@JonRowe Thanks for the speedy fix! I've updated https://github.com/magni-/rspec-rails-dummy, this fixes the errors seen on 6.0.0 👍🏼 If you try running the specs yourself, you'll see there's still a couple of errors, but those were already present on 5.1.2 and seem to be due to |
The last two specs seem to be Rails behaviour due to the overlapping method names, its not something we control we just provide access to an action view testcase. |
Dependabot PR for 6.0.1 came in, our build passed |
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
tov6.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 argumentArgumentError: 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
The text was updated successfully, but these errors were encountered: