aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "Remove literal? check to fix issue with prefixed optionals"eileencodes2016-01-201-12/+0
| | | | | | | | | This reverts commit 5d1b7c3b441654e8008dcd303f5367883ec660a6. The change here didn't actually fix the issue it was trying to fix, and this isn't the correct way to fix either issue. The problem is switching from the builder to grouping with find_all/regex is now very dependent on how you structure your path pattern.
* Remove literal? check to fix issue with prefixed optionalseileencodes2016-01-161-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In commit d993cb3 `build_path` was changed from using `grep` to `find_all` to save array allocations. This change was a little too aggressive in that when the dash comes before the symbol like `/omg-:song` the symbol is skipped. Removing the check for `n.right.left.literal?` fixes this issue, but does add back some allocations. The number of allocations are still well less than before. I've added a regression test to test this behavior for the future. Fixes #23069. Array allocations as of d993cb3: ``` {:T_SYMBOL=>11} {:T_REGEXP=>17} {:T_STRUCT=>6500} {:T_MATCH=>12004} {:T_OBJECT=>91009} {:T_DATA=>100088} {:T_HASH=>114013} {:T_STRING=>159637} {:T_ARRAY=>321056} {:T_IMEMO=>351133} ``` Array allocations after this change: ``` {:T_SYMBOL=>11} {:T_REGEXP=>1017} {:T_STRUCT=>6500} {:T_MATCH=>12004} {:T_DATA=>84092} {:T_OBJECT=>87009} {:T_HASH=>110015} {:T_STRING=>166152} {:T_ARRAY=>322056} {:T_NODE=>343558} ```
* Remove arity check for `RouteSet#draw`yui-knk2015-11-211-6/+0
| | | | | This code was added for migration from Rails 3.1 to upper, now we are developing Rails 5.
* Merge pull request #21094 from aditya-kapoor/add-missing-ap-testsRafael Mendonça França2015-08-251-0/+10
|\ | | | | add missing test for action regexp for routing
| * add missing tests for action regexpAditya Kapoor2015-08-021-0/+10
| |
* | use `make_set` helper method to generate route setsAaron Patterson2015-08-241-31/+1
| | | | | | | | We should keep the route set generation logic in one place
* | Merge pull request #21106 from amitsuroliya/fix_routing_testAndrew White2015-08-211-6/+0
|\ \ | | | | | | Remove duplicity in tests
| * | Remove duplicity in testsamitkumarsuroliya2015-08-031-6/+0
| |/
* / Add missing assertion for test_route_with_colon_firstAditya Kapoor2015-08-031-2/+4
|/
* Why do we add a top-level constant here?Akira Matsuda2015-04-251-5/+3
|
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-4/+4
|
* Fix cases where the wrong name is passed to `Formatter#generate`Godfrey Chan2014-11-231-1/+1
| | | | | These are currently working "by accident" because `match_route` does not check that the name is valid.
* Anchor should not be appended when set to nil/false.Guo Xiang Tan2014-11-231-0/+3
| | | | Fixes https://github.com/rails/rails/issues/17714.
* stop calling url_for with recall parameters and actually use a requestAaron Patterson2014-07-151-82/+123
|
* execute a request and check the path_parametersAaron Patterson2014-07-151-17/+59
| | | | | | | | This actually runs a request through the system, using the actual routing methods as we would use in production, then tests the path_parameters set on the request object. The `recognize_path` method isn't actually used in production, so testing what it returns isn't useful.
* set `set` in the setup methodAaron Patterson2014-07-151-2/+5
|
* remove useless ivar setAaron Patterson2014-07-151-1/+0
|
* remove warningsKuldeep Aggarwal2014-06-121-1/+0
| | | | warning: assigned but unused variable - scope_called, path and strexp
* add tests for nested lambda constraintsAaron Patterson2014-06-031-0/+27
|
* PARAMETERS_KEY is only used in the request, so move the constant thereAaron Patterson2014-05-271-5/+5
|
* just call the method and assert the return valueAaron Patterson2014-05-091-8/+1
| | | | do not test internals
* Prefer assert_raise instead of flunk + rescue to test for exceptionsCarlos Antonio da Silva2013-12-191-10/+3
| | | | | | Change most tests to make use of assert_raise returning the raised exception rather than relying on a combination of flunk + rescue to check for exception types/messages.
* Eliminate `JSON.{parse,load,generate,dump}` and `def to_json`Godfrey Chan2013-11-051-14/+15
| | | | | | | | | | | | | | | JSON.{dump,generate} offered by the JSON gem is not compatiable with Rails at the moment and can cause a lot of subtle bugs when passed certain data structures. This changed all direct usage of the JSON gem in internal Rails code to always go through AS::JSON.{decode,encode}. We also shouldn't be implementing `to_json` most of the time, and these occurances are replaced with an equivilent `as_json` implementation to avoid problems down the road. See [1] for all the juicy details. [1]: intridea/multi_json#138 (comment)
* Fix an issue where router can't recognize downcased url encoding path.kennyj2013-09-191-0/+4
|
* fix request methods testVipul A M2013-03-311-6/+2
|
* Update tests for #9704, named route collisionsJeremy Kemper2013-03-241-5/+6
| | | | | * Fix named route collision in mount test fixture * Update controller named route precedence test
* Add tests for #9441Francesco Rodriguez2013-02-261-0/+16
|
* do not append a second slash when usingYves Senn2013-01-021-6/+16
|
* Add Missing Keys from Journey on failed URL formatschneems2012-08-281-6/+6
| | | | | | | | | | | | | | | | | | | | | | | Many named routes have keys that are required to successfully resolve. If a key is left off like this: <%= link_to 'user', user_path %> This will produce an error like this: No route matches {:action=>"show", :controller=>"users"} Since we know that the :id is missing, we can add extra debugging information to the error message. No route matches {:action=>"show", :controller=>"users"} missing required keys: [:id] This will help new and seasoned developers look closer at their parameters. I've also subclassed the routing error to be clear that this error is a result of attempting to generate a url and not because the user is trying to visit a bad url. While this may sound trivial this error message is misleading and confuses most developers. The important part isn't what's in the options its's what's missing. Adding this information to the error message will make debugging much more obvious. This is the sister pull request of https://github.com/rails/journey/pull/44 which will be required to get they missing keys into the correct error message. Example Development Error in Rails: http://cl.ly/image/3S0T0n1T3421
* Access @rs only through attr_accessortomykaira2012-08-201-11/+11
|
* Support unicode character route in config/routes.rb.kennyj2012-06-161-0/+5
|
* adding a test for #6459Aaron Patterson2012-06-141-0/+10
|
* Merge pull request #2549 from trek/RoutingErrorForMissingControllersAaron Patterson2012-05-211-0/+10
|\ | | | | When a route references a missing controller, raise ActionController::RoutingError with clearer message
| * When a route references a missing controller, raise ↵Trek Glowacki2011-08-161-0/+10
| | | | | | | | ActionController::RoutingError with a clearer message
* | Force given path to http methods in mapper to skip canonical action checkingCarlos Antonio da Silva2012-05-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes the following scenario: resources :contacts do post 'new', action: 'new', on: :collection, as: :new end Where the /new path is not generated because it's considered a canonical action, part of the normal resource actions: new_contacts POST /contacts(.:format) contacts#new Fixes #2999
* | ActionPack: remove tests for hash_for_* methodsBogdan Gusiev2012-05-021-18/+0
| |
* | Remove default match without specified methodJose and Yehuda2012-04-241-168/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the current router DSL, using the +match+ DSL method will match all verbs for the path to the specified endpoint. In the vast majority of cases, people are currently using +match+ when they actually mean +get+. This introduces security implications. This commit disallows calling +match+ without an HTTP verb constraint by default. To explicitly match all verbs, this commit also adds a :via => :all option to +match+. Closes #5964
* | Route root helper shortcutBrian Cardarella2012-03-031-0/+9
| | | | | | | | Allow the root route helper to accept just a string
* | Optimize url helpers.Sergey Nartimov + José Valim2012-03-021-3/+3
| |
* | Adding tests for non-optional glob parametersAndrew White2012-02-261-2/+27
| |
* | Add config.default_method_for_update to support PATCHDavid Lee2012-02-221-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PATCH is the correct HTML verb to map to the #update action. The semantics for PATCH allows for partial updates, whereas PUT requires a complete replacement. Changes: * adds config.default_method_for_update you can set to :patch * optionally use PATCH instead of PUT in resource routes and forms * adds the #patch verb to routes to detect PATCH requests * adds #patch? to Request * changes documentation and comments to indicate support for PATCH This change maintains complete backwards compatibility by keeping :put as the default for config.default_method_for_update.
* | adding tests to document behavior for #4817Aaron Patterson2012-02-141-0/+26
| |
* | Cleaning Route generation testsThiago Pradi2012-02-121-30/+0
| |
* | Merge pull request #3775 from karevn/masterAaron Patterson2012-01-241-1/+14
|\ \ | | | | | | Please pull my changes - they fix a rare problem with tests framework
| * | Fix: when using subdomains and constraints, request params were not passed ↵karevn2011-11-281-1/+14
| |/ | | | | | | to constraints callback
* | Added custom regexps to ASTs that have literal nodes on either side ofAaron Patterson2012-01-231-0/+62
| | | | | | | | symbol nodes. Fixes #4585
* | moved the `get` testing method to a moduleAaron Patterson2012-01-231-11/+2
| |
* | Remove rescue_action from compatibility module and testsCarlos Antonio da Silva2012-01-171-1/+0
| |
* | AP tests should inherit from AS::TestCaseAaron Patterson2012-01-051-2/+2
| |