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
Check class collision for scaffold controller generator is broken #37543
Comments
Can you please provide a sample application that reproduces the issue? |
I provided an example application in https://github.com/kdiogenes/generator-class-collision. In the README there I already put the output for the commands For the first, there is no complaint about |
Thanks for your example application. I understood the issue. We don't want to expose the APIs unless really need it. In this case, it is better to specify |
Sorry, but I was unable to produce an executable test case for generators from the templates. I'm getting
cannot load such file
whenrequire "generators/generators_test_helper"
.Steps to reproduce
Add the following test case to
scaffold_controller_generator_test.rb
:Expected behavior
Test pass (a collision is detected)
Actual behavior
Test fail (no collision detected)
This generator creates a
UsersControllers
, but checksUserController
for collision. From the check_class_collision implementation I guess that the assumption is wrong. If I understand right,respond_to?(:controller_class_name)
will always return false, since controller_class_name is private. In 2017 it was protected and prior to ruby 1.9 I guess that it was returning true based on this ruby issue.Maybe
named_base_test.rb
could have exposed this problem if its assert_name implementation doesn't usesend
. I think everything being tested here is expected to be public, right?Let me know if my assumptions are right, I'm looking to work in a PR!
The text was updated successfully, but these errors were encountered: