aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing/inspector_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-2/+2
|
* Rails guides are now served over httpsPaul McMahon2018-07-241-5/+5
| | | | | http links will be redirected to the https version, but still better to just directly link to the https version.
* Fix routing inspector tests broken in ↵Kasper Timm Hansen2018-03-131-14/+15
| | | | | | | | | | https://github.com/rails/rails/commit/6629d51a2756fadf961bb09df20579cacfef2c8e * Renames grep_pattern to grep throughout. * Fixes setup not calling super by calling setup with a block. * Converts test helper method to a private one, like we have it other places. * Uses keyword arguments to get around awkward draw({ grep: "x" }, Action…) construction.
* Introduce `ActionDispatch::Routing::ConsoleFormatter::Base`bogdanvlviv2018-03-131-11/+11
| | | | | | | | | | | | | | - Create `Base` and inherit `Sheet` and `Expanded` in order to - prevent code duplication. - Remove trailing "\n" for components of `Expanded`. - There is no need for `Expanded#header` to return `@buffer` so return `nil` instead. - Change `no_routes` message "No routes were found for this controller" since if use `-g`, it sounds incorrect. - Display `No routes were found for this controller.` if apply `-c`. - Display `No routes were found for this grep pattern.` if apply `-g`. Related to #32130
* Draw line of a route name to the end of row console on `rails routes --expanded`bogdanvlviv2018-03-051-5/+10
| | | | | | | In order to get width of console use `IO::console_size`, See https://ruby-doc.org/stdlib-2.4.1/libdoc/io/console/rdoc/IO.html#method-c-console_size Related to #32130
* Add --expanded option to "rails routes"Benoit Tigeot2018-02-281-2/+66
| | | | | | | | | | | | | | | | | | | | | | | | | When using rails routes with small terminal or complicated routes it can be very difficult to understand where is the element listed in header. psql had the same issue, that's why they created "expanded mode" you can switch using `\x` or by starting psql with ``` -x --expanded Turn on the expanded table formatting mode. This is equivalent to the \x command. ``` The output is similar to one implemented here for rails routes: db_user-# \du List of roles -[ RECORD 1 ]---------------------------------------------- Role name | super Attributes | Superuser, Create role, Create DB Member of | {} -[ RECORD 2 ]---------------------------------------------- Role name | role Attributes | Superuser, Create role, Create DB, Replication Member of | {}
* 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 three new rubocop rulesRafael Mendonça França2016-08-161-2/+2
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-061-2/+1
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-9/+9
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-39/+39
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Merge pull request #23103 from rails/refactor-handling-of-action-defaultJeremy Daer2016-04-241-1/+1
|\ | | | | | | Refactor handling of :action default in routing
| * Refactor handling of :action default in routingAndrew White2016-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The longstanding convention in Rails is that if the :action parameter is missing or nil then it defaults to 'index'. Up until Rails 5.0.0.beta1 this was handled slightly differently than other routing defaults by deleting it from the route options and adding it to the recall parameters. With the recent focus of removing unnecessary duplications this has exposed a problem in this strategy - we are now mutating the request's path parameters and causing problems for later url generation. This will typically affect url_for rather a named url helper since the latter explicitly pass :controller, :action, etc. The fix is to add a default for :action in the route class if the path contains an :action segment and no default is passed. This change also revealed an issue with the parameterized part expiry in that it doesn't follow a right to left order - as soon as a dynamic segment is required then all other segments become required. Fixes #23019.
* | [ci skip] Use rails routes instead of rake routes in inspector test descriptionAbhishek Jain2016-03-021-9/+9
| |
* | Deprecate :controller and :action path parametersAndrew White2016-03-011-4/+12
| | | | | | | | | | | | | | | | 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.
* | Add `internal` attribute to routesJon Moss2016-02-221-0/+23
|/ | | | | | | | | | | | | | This is meant to provide a way for Action Cable, Sprockets, and possibly other Rack applications to mark themselves as internal, and to exclude themselves from the routing inspector, and thus `rails routes` / `rake routes`. I think this is the only way to have mounted Rack apps be marked as internal, within AD/Journey. Another option would be to create an array of regexes for internal apps, and then to iterate over that everytime a request comes through. Also, I only had the first `add_route` method set `internal`'s default to false, to avoid littering it all over the codebase.
* Add options for rake routes taskVipul A M2016-02-021-7/+27
| | | | | | | | | | Add two options: `-c` and `-g`. `-g` option returns the urls name, verb and path fields that match the pattern. `-c` option returns the urls for specific controller. Fixes #18902, and Fixes #20420 [Anton Davydov & Vipul A M]
* Better error message when running `rake routes` with CONTROLLER arg:Edouard CHIN2016-01-071-0/+38
| | | | | | | - `CONTROLLER` argument can now be supplied in different ways (Rails::WelcomeController, Rails::Welcome, rails/welcome) - If `CONTROLLER` argument was supplied but it does not exist, will warn the user that this controller does not exist - If `CONTROLLER` argument was supplied and no routes could be found matching this filter, will warn the user that no routes were found matching the supplied filter - If no routes were defined in the config/routes.rb file, will warn the user with the original message
* Change `Journey::Route#verb` to return string instead of regexp.yui-knk2015-10-031-0/+11
| | | | | | | | | By [this commit](https://github.com/rails/rails/commit/0b476de445faf330c58255e2ec3eea0f3a7c1bfc) `Journey::Route#verb` need not to return verb as regexp. The returned value is used by inspector, so change it to be a string. Add inspect_with_multiple_verbs test case to keep the behavior of inspector correctly.
* Get rid of mocha tests - part 2Marcin Olichwirowicz2015-08-251-9/+0
|
* Fix rake routes for api appsJorge Bejar2015-04-251-0/+16
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Change filter on /rails/info/routes to use an actual path regexp from railsbrainopia2015-02-231-8/+0
| | | | | | | | Change filter on /rails/info/routes to use an actual path regexp from rails and not approximate javascript version. Oniguruma supports much more extensive list of features than javascript regexp engine. Fixes #18402.
* Mounted Rack apps should have default named routes based on app nameT.J. Schuck2014-12-061-11/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression in 4.2.0 from 4.1.8. https://github.com/rails/rails/pull/17823 fixed a similar regression regarding _explicitly_ named routes for a mounted Rack app, but there was another regression for the default value. With a route like: Rails.application.routes.draw do mount Mountable::Web, at: 'some_route' end The "Prefix" column of rake routes gives the following: - 4.1.8: mountable_web - 4.2.0.beta1-4: [nothing] - 4.2.0.rc1: [nothing] - 4.2.0.rc2: some_route <- regression This fixes the default to go back to being based off the name of the class like the docs specify: https://github.com/rails/rails/blob/785d04e3109f69d0b9b9f4732179592f0ef04e52/actionpack/lib/action_dispatch/routing/mapper.rb#L558-L560 Explicitly named routes still work correctly per https://github.com/rails/rails/pull/17823: Rails.application.routes.draw do mount Mountable::Web, at: 'some_route', as: 'named' end - 4.1.8: named - 4.2.0.beta1-4: [nothing] - 4.2.0.rc1: [nothing] - 4.2.0.rc2: named
* Pure rack apps can be mounted with a nameJean Boussier2014-11-291-1/+1
| | | | See https://github.com/rails/rails/commit/9b15828b5c347395b42066a588c88e5eb4e72279#commitcomment-8764492
* Transform dashes to underscores in resource route namesByron Bischoff2014-01-251-3/+13
| | | | Fixes #13824
* Fix `rake routes` error when `Rails::Engine` with empty routes is mounted; ↵Maurizio De Santis2014-01-241-0/+21
| | | | | | fixes rails/rails#13810 Squash
* Tidy up tests and CHANGELOG for #12598Andrew White2014-01-201-3/+14
|
* Automatically convert dashes to underscores for url helpersAmr Tamimi2014-01-201-1/+3
|
* Show routes defined under assets prefixRyunosuke SATO2013-12-191-0/+12
| | | | Closes #9625
* Build fix for Routing InspectorArun Agrawal2013-11-221-2/+2
| | | | | | Broken by 6701b4cf41f6f3d9cfc6a93715acbf852d1e468e
* Fix for routes taskSıtkı Bağdat2013-11-211-16/+16
| | | | This commit fixes formatting issue for `rake routes` task, when a section is shorter than a header.
* `RoutesInspector` deals with routes using regexp as `:controller` optionYves Senn2013-05-301-0/+9
|
* Fix AP tests related to routes inspector output and the new column titlesCarlos Antonio da Silva2013-02-191-20/+65
|
* In Browser Path Matching with Javascriptschneems2013-01-201-0/+8
| | | | | | | | | | | When debugging routes ,it can sometimes be difficult to understand exactly how the paths are matched. This PR adds a JS based path matching widget to the `/rails/info/routes` output. You can enter in a path, and it will tell you which of the routes that path matches, while preserving order (top match wins). The matching widget in action: ![](http://f.cl.ly/items/3A2F0v2m3m1Z1p3P3O3k/path-match.gif) Prior to this PR the only way to check matching paths is via mental math, or typing in a path in the url bar and seeing where it goes. This feature will be an invaluable debugging tool by dramatically decreasing the time needed to check a path match. ATP actionpack
* Needless requiresAkira Matsuda2013-01-061-2/+0
|
* Missing requiresAkira Matsuda2013-01-061-0/+1
|
* split formatting concerns from RoutesInspectorYves Senn2013-01-051-4/+21
|
* Add active_support/testing/autorunRafael Mendonça França2012-12-311-1/+1
| | | | | minitest/autorun load minitest/spec polluting the global namespace with the DSL that we don't want on Rails
* fixing most tests on Ruby 2.0Aaron Patterson2012-09-251-2/+2
|
* Rename RouteInspector to RoutesInspectorCarlos Antonio da Silva2012-07-081-2/+2
| | | | Follow the consistency defined in dbc43bc.
* move route_inspector to actionpack@schneems and @mattt2012-07-071-0/+170
this is so we can show route output in the development when we get a routing error. Railties can use features of ActionDispatch, but ActionDispatch should not depend on Railties.