The generator for controllers has trouble with multi-word names. Creating a multi-word controller name results in incorrect file names or incorrect class names, depending on the name you pass.
Test case 1: amber g controller PostComments
Test case 2: amber g controller post_comments
Expected behavior:
post_comments_controller_spec.cr was created.post_comments_controller.cr was created.PostCommentsControllerActual behavior: [What actually happens]
Test case 1:
PostcommentsControllerpostcomments_controller, rather than an underscore between the words.Test case 2:
Post_commentsControllerReproduces how often:
Always
0.3.0
After looking further, this seems to be pretty generic as to how all file names and class names are created. I'm seeing the same issue when generating models as well.
Perhaps the generators should have a shared piece of logic for taken a user-given name and discerning its CamelCase and snake_case names.
@aarongodin How do you feel about opening a PR addressing this issue? 馃槃 We welcome the help.
@eliasjpr not a problem! I would love to help out.
@aarongodin - If you don't object, I would like to take a shot at this.
@marksiemers Looks nice!
@aarongodin - Is this fixed for you on the master branch? Can we close the issue?
@marksiemers It's fixed from my perspective. Closing!
Most helpful comment
@eliasjpr not a problem! I would love to help out.