aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/journey/router_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* 1. Replaced unused variables by `_`.alkesh262019-01-221-3/+3
| | | | 2. Typo fixes.
* Fix bug with eager_load in development environmentDan Jensen2018-06-111-0/+9
| | | | | Modifies the routes simulator to allow for empty RouteSets, which are created when secondary Engines are loaded.
* Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the futureRyuta Kamizono2017-12-141-1/+1
| | | | Follow up of #31432.
* Fix RuboCop offensesKoichi ITO2017-08-161-5/+5
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* Use frozen string literal in actionpack/Kir Shatrov2017-07-291-0/+2
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-11/+11
|
* Show an "unmatched constraints" error for mismatching and present paramsChris Carter2016-10-031-1/+1
| | | | | | | | | | | | Currently a misleading "missing required keys" error is thrown when a param fails to match the constraints of a particular route. This commit ensures that these params are recognised as unmatching rather than missing. Note: this means that a different error message will be provided between optimized and non-optimized path helpers, due to the fact that the former does not check constraints when matching routes. Fixes #26470.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-16/+16
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-4/+4
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-31/+31
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-7/+7
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-50/+50
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-85/+85
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Deprecate :controller and :action path parametersAndrew White2016-03-011-61/+69
| | | | | | | | Allowing :controller and :action values to be specified via the path in config/routes.rb has been an underlying cause of a number of issues in Rails that have resulted in security releases. In light of this it's better that controllers and actions are explicitly whitelisted rather than trying to blacklist or sanitize 'bad' values.
* Remove TestRouter#add_routesakihiro172015-09-291-11/+0
| | | | | | Now, we use the mapper to build the routing table related to https://github.com/rails/rails/commit/703275ba70efbefb3358052b6ba750443eff1a28
* File encoding is defaulted to utf-8 in Ruby >= 2.1Akira Matsuda2015-09-181-1/+0
|
* use the mapper to build the routing tableAaron Patterson2015-08-151-200/+89
| | | | | | We should build the routes using the user facing API which is `Mapper`. This frees up the library internals to change as we see fit. IOW we shouldn't be testing internals.
* only keep one hash of named routesAaron Patterson2015-08-141-5/+6
| | | | | The outer router object already keeps a hash of named routes, so we should just use that.
* rm add_route2Aaron Patterson2015-08-141-26/+32
| | | | | refactor the tests with a backwards compatible method call so we can rm add_route2 from the journey router
* use predicate methods instead of hard coding verb stringsAaron Patterson2015-08-141-5/+4
| | | | | also change the feeler to subclass AD::Request so that it has all the methods that Request has
* remove StrexpAaron Patterson2015-08-131-30/+23
| | | | | This was a useless object. We can just directly construct a Path::Pattern object without a Strexp object.
* pass anchor directly to `Pattern`Aaron Patterson2015-08-131-22/+22
| | | | | the caller already has it, there is no reason to pack it in to an object and just throw that object away.
* Revert "Merge pull request #20584 from arthurnn/fix_url"Arthur Neves2015-06-171-7/+0
| | | | | | | | This reverts commit 0b3397872582f2cf1bc6960960a6393f477c55e6, reversing changes made to 56d52e3749180e6c1dcf7166adbad967470aa78b. As pointed out on the PR, this will hide development mistakes too, which is not ideal.
* Catch InvalidURIError on bad paths on redirect.Arthur Neves2015-06-161-0/+7
| | | | | Handle URI::InvalidURIError errors on the redirect route method, so it wont raise a 500 if a bad path is given.
* extract required_defaults from the conditions hash before constructing the routeAaron Patterson2015-06-081-26/+26
| | | | | this way we can remove the strange "respond_to?" conditional in the `matches?` loop
* sort_by instead of sortYang Bo2015-04-081-0/+27
| | | | | | it is avoid sort errot within different and mixed keys. used `sort_by` + `block` to list parameter by keys. keep minimum changes
* 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.
* fix url generation error messageAccessd2014-10-211-0/+10
|
* Improve router test.Guo Xiang Tan2014-08-211-6/+11
| | | | | We should assert that routes will not be recognized if the verbs do not match.
* Avoid duplicating routes for HEAD requests.Guo Xiang Tan2014-08-211-1/+20
| | | | | | | | Follow up to rails#15321 Instead of duplicating the routes, we will first match the HEAD request to HEAD routes. If no match is found, we will then map the HEAD request to GET routes.
* remove warningsKuldeep Aggarwal2014-06-121-2/+0
| | | | warning: assigned but unused variable - scope_called, path and strexp
* Path::Pattern is instantiated internally, so make the contructor require a ↵Aaron Patterson2014-05-291-15/+19
| | | | strexp object
* add an alternate constructor to Strexp that takes a stringAaron Patterson2014-05-291-16/+16
|
* Remove TODO.Guo Xiang Tan2014-05-281-11/+1
|
* pass the request object to the applicationAaron Patterson2014-05-251-2/+5
|
* push is_a?(Dispatcher) check in to one placeAaron Patterson2014-05-241-0/+1
|
* glob_param is never used, so rmAaron Patterson2014-05-231-1/+5
| | | | | | this also changes the constructor. We don't need to pass more options than "defaults" (whatever defaults are, ugh. probably another hash of stupid stuff).
* decouple the router object from the request classAaron Patterson2014-05-231-14/+6
|
* pass the correct custom request to the recognize methodAaron Patterson2014-05-231-13/+10
|
* switch to the `serve` method so we can remove the request class (eventually)Aaron Patterson2014-05-231-2/+6
|
* remove NullRequest and just always pass a request classAaron Patterson2014-05-231-3/+7
|
* use the request object since we have itAaron Patterson2014-05-231-1/+3
| | | | | stop hardcoding hash keys and use the accessors provided on the request object.
* middle variable is never used, so rmAaron Patterson2014-05-211-14/+14
|
* we don't use this parameter for anything, so rmAaron Patterson2014-05-201-20/+19
|
* Make URL escaping more consistentAndrew White2014-04-201-1/+12
| | | | | | | | | | | | | | | | | | | | | | 1. Escape '%' characters in URLs - only unescaped data should be passed to URL helpers 2. Add an `escape_segment` helper to `Router::Utils` that escapes '/' characters 3. Use `escape_segment` rather than `escape_fragment` in optimized URL generation 4. Use `escape_segment` rather than `escape_path` in URL generation For point 4 there are two exceptions. Firstly, when a route uses wildcard segments (e.g. *foo) then we use `escape_path` as the value may contain '/' characters. This means that wildcard routes can't be optimized. Secondly, if a `:controller` segment is used in the path then this uses `escape_path` as the controller may be namespaced. Fixes #14629, #14636 and #14070.
* Skip Rack applications and redirects when generating urlsAndrew White2013-07-161-9/+13
| | | | | | | | | | When generating an unnamed url (i.e. using `url_for` with an options hash) we should skip anything other than standard Rails routes otherwise it will match the first mounted application or redirect and generate a url with query parameters rather than raising an error if the options hash doesn't match any defined routes. Fixes #8018
* Raise correct exception now Journey is integrated.Andrew White2013-01-151-4/+4
| | | | | | | Now that Journey has been integrated into ActionDispatch we can raise the exception ActionController::UrlGenerationError directly rather than raising the internal Journey::Router::RoutingError and then have ActionDispatch::Routing::RouteSet#generate re-raise the exception.