-
-
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
explicitly included helper methods not available (any more) with Rails 6.1 #2481
Comments
Hello @robinboening Could you try with Cheers |
Thanks for the blazingly fast response, @benoittgt I can confirm its failing using the current I created a rails 6.1 app showing the failing example, using rspec-rails |
Thanks @robinboening for the perfect repro app. I played a little bit with the code and Rails. The PR from @jhawthorn is very interesting. I was not able to find a solution after 1h. I am wondering if we should not call explicitly a method to defined them helper method? @jhawthorn any idea? |
Just pinging @jhawthorn again in case he missed it :) |
I am also seeing this issue, but in a different context than what @robinboening reported. However, I think my issue is the same. In my case, I have a view spec that is testing a view which uses a helper method that is defined in the controller using This started appearing after upgrading to Rails 6.1 only. I have created another repo to demonstrate the issue I am seeing: https://github.com/aergonaut/rspec-rails-helper-method-issue-demo The This method is defined in When running the server, the helper method works as expected. But in the view spec, the helper cannot be found. The output is this:
|
Hi 👋 , |
Hello I am wondering if providing a reproducing template using https://github.com/rails/rails/tree/main/guides/bug_report_templates to see if the issue isn't on the rails side? |
There is an interesting answer from John Hawthorn here rails/rails#40204 (comment) And also this PR rails/rails#40125 |
What Ruby, Rails and RSpec versions are you using?
Ruby version: 2.7.1
Rails version: 6.1
RSpec-core version: 3.10.1
RSpec-rails version: 4.1.1
Observed behaviour
In a helper spec, when explicitly including methods as
helper_method
's into the current controller the methods are not available on the ActionView level.Simplified example
The example fails with
This is only a problem with Rails 6.1 as it doesn't fail with Rails 6.0.x.
I was able to track down what change in Rails is causing the issue
rails/rails@758ad13#diff-3149407bd2f6287e7791fc3e0cc5b2559d7e4e0c19eb1e7f7ea84e0db1e35ac5L33-R50
but I am not fully understanding the change nor do I know if rspec-rails needs to adapt to that change or if this change in rails is simply a bug.
Expected behaviour
bar
should be available within ActionView; the example should succeed.Can you provide an example app?
I will see if I can set up a demo app, if needed.
Let me know if I can provide more details.
Cheers
Robin
The text was updated successfully, but these errors were encountered: