-
Notifications
You must be signed in to change notification settings - Fork 148
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
Feature: routes path specs #123
Conversation
Oh, however Travis CI already shows me some errors with older versions of Ruby. I'll check that out and push fixes to the PR. (I used |
build_path_spec: (route) -> | ||
spec = '' | ||
|
||
visit_spec = (r, wildcard=false) -> |
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.
Why do you use nested function here? I think better to use a recursive call of build_path_spec
by itself and construct result as returing value but not as spec
closure variable. Just like it is done in route formatter.
@olance Please, rebase your pull request from new HEAD :) |
…ven route, from its binary tree. Each route helper now has an extra `spec` function attached to it that will return the path spec. Using the `route` private function to build each route helper Adapting existing tests to the new code for JS route calls Testing the path spec generation. Still failing on wildcard routes in Rails 3.2 Fix for 3.2 globbing Readme update to document the path spec function `Array#to_h` is too recent
37851ed
to
88386e5
Compare
sorry guys, I'm a bit out of free time currently, but I haven't forgotten you |
Glad to help! On Wed, Dec 17, 2014 at 8:20 PM, Bogdan Gusiev notifications@github.com
|
Closes #122
As discussed in #122, here's a PR to add a
spec()
function to route helpers.It is computed in the
build_path_spec
method from the route's binary tree, with bonus codesize-per-route reduction ;)I had to change one test and remove two because of the way routes are now built:
The reason is that we do not create one function per route with arguments names anymore. (the arguments names were not used anyway, as
build_path
was givenarguments
directly)Maybe we should find a way to keep the information about the arguments names somewhere?
I have added tests in the
path_specs_generation_spec.rb
spec file. All routes are loaded and two examples are dynamically created for each route, so that if one example fails, we directly know for which route (I have included the name of the route in the examples names).Tests have been successful on my machine for all Rails versions included in Appraisal.