-
Notifications
You must be signed in to change notification settings - Fork 53
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
It still breaks the view tests #24
Comments
Can you please provide a sample application that reproduces the error? |
@rafaelfranca we got a reproduction case provided for us on rspec/rspec-rails#1644 (comment). My demo app is here: https://github.com/samphippen/demo_app_for_rspec_1644 In commit fables-tales/demo_app_for_rspec_1644@82a6bd1 you can see a passing test using one of the helpers The next commit adds the I might be able to take a look at this from the RSpec end, but if you can take a look at it from the rails view, that'd be great. /cc @sgrif |
Thanks! I'll take a look. |
I've looked into this problem and it seems like the issue has something to do with Both secureheaders gem[1] and rails-controller-testing gem[2] open a subclass within I think the issue may have something to do with 1.) https://github.com/twitter/secureheaders/blob/master/lib/secure_headers/view_helper.rb#L111 |
Secure Headers doesn't seem to use Active Support's load hooks at https://github.com/twitter/secureheaders/blob/9bf22e772e6d84f79c97e6afbd53a46a7cf8612b/lib/secure_headers/view_helper.rb#L113. That is guaranteed to cause inter-op issues and is likely why removing it in one gem makes it work. |
I managed to isolate the cause of this issue in one of my projects, and it came down to the |
@kaspth thanks that seems to have fixed the problem, but I don't understand why not using |
@mrageh sure thing! I can totally understand why you find it tough to understand, I could barely find any docs for These load hooks are how Rails communicates that you can now extend a component because it is fully loaded. If one gem does not use a hook Rails can't guarantee it's been loaded correctly. So things can work, but they can also break at the inclusion of, say, another gem. Hope that clears it up 😁 |
When using |
It depends, if action view is not required to the gem work in a railtie. One example of this is the observers initializer we have in activeresource. You can make activeresource work without observers. If the gem only works if action view is present it can be in the place that do the inclusion, in the case in the lib file. |
👏 to @sgrif for fixing this issue. |
When using rspec with rails-controller-testing, specs would break due to incorrect load order. More info here: rails/rails-controller-testing#24
It seems the bug of #12 is still there. The url helpers are not working for view tests.
The text was updated successfully, but these errors were encountered: