-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
Add route prefix macro and specs #1121
Add route prefix macro and specs #1121
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super stoked for this! A few of my apps already need something like this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really good! Just to make sure we don't have any regressions could you add a couple extra specs?
- Layered inheritance. So maybe a
abstract class TestApiPrefixAction < TestAction
and then another actionChildApiPrefixAction < TestApiPrefixAction
. It could have just one route and the spec would check that it still correctly prefixed the route - Modules. It may be helpful/common for people to make a route prefix module that is added to multiple actions. Could you create a
ApiPrefix
module and then an action that includes it and see if the action gets the prefix correctly?
Something like:
module ApiPrefix
macro included
route_prefix "/api"
end
end
Does that make sense?
@paulcsmith, for the Layered Inheritance spec, would the abstract class use the route_prefix macro and test the child correctly prefixes it's own routes from the parent's defined prefix? ` class ChildApiTestPrefixAction < ApiTestPrefixAction |
@rnice01 Yeah that's exactly what I had in mind! 👍 |
parent prefixes
…/route-prefix-macro
inherit route settings from first ancestor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks fantastic! Thanks for doing this :)
oh man! Stoked for this ❤️ |
Fixes #1087
Purpose
This PR is for issue #1087 for adding a
route_prefix
macro for Lucky::Actions. This will prefix all the routes added by the HTTP method and match macros.Checklist
crystal tool format spec src
./script/setup
./script/test