1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/test/journey
eileencodes 437ab2031e
Convert route params array into object
This PR converts the route params array into an object and moves the
error generation code into its own object as well. This is a refactoring
of internal code to make it easier to change and simplier for internals
to interface with. We have two new objects:

1) `RouteWithParams`

Previously `#generate` returned an array of parameterized parts for a
route. We have now turned this into an object with a `path` and a
`params methods` to be able to access the parts we need.

2) `MissingRoute`

`#generate` was also responsible for constructing the message for the
error. We've moved this code into the new `MissingRoute` object so it
does that work instead.

This change makes these methods reusable throughout the code and easier
for future refactoring we plan to do.

Co-authored-by: Aaron Patterson <aaron.patterson@gmail.com>
2020-06-05 13:18:49 -04:00
..
gtg Remove unused journey code 2020-04-25 00:40:37 +09:00
nodes Use assert_predicate and assert_not_predicate 2018-01-25 23:32:59 -05:00
path Memoize regex when checking missing route keys 2020-01-08 08:36:29 +01:00
route/definition Enable Layout/EmptyLinesAroundAccessModifier cop 2019-06-13 12:00:45 +09:00
router Enable Performance/UnfreezeString cop 2018-09-23 08:56:55 +09:00
route_test.rb Remove Route#build as it wasn't used 2019-05-22 23:59:18 +02:00
router_test.rb Convert route params array into object 2020-06-05 13:18:49 -04:00
routes_test.rb Use assert_empty and assert_not_empty 2018-01-25 23:32:59 -05:00