aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
Commit message (Collapse)AuthorAgeFilesLines
...
| * Change `SystemTestCase.driven_by` to use `setup`/`teardown` hooksLucas Mazza2017-02-243-15/+21
| | | | | | | | | | | | Previously, `driven_by` would change the Capybara configuration when the test case is loaded, and having multiple test classes with different `driven_by` configs would fail as the last loaded would be effective.
| * Move documentation to the correct placeeileencodes2017-02-231-72/+72
| | | | | | | | | | The documentation needs to be above the method to correctly document the method.
| * Do not take screenshot when test skippedyuuji.yaginuma2017-02-231-2/+6
| |
| * [ci skip] Fix more quotes in direct/resolve docsAndrew White2017-02-231-3/+3
| | | | | | | | Also correct use of `direct class:` to `resolve` in example.
| * Clarify use of params in `direct`Andrew White2017-02-221-0/+9
| | | | | | | | | | | | | | | | | | Since a `direct` url helper block is evaluated using `instance_exec` then methods that are available in the instance context can be accessed, e.g. the params object in a controller action or view. This wasn't clear from the example so expand on that point and add a test case for this situation.
| * Bump removal of `/:controller/:action` to Rails 5.2Andrew White2017-02-221-2/+2
| |
| * [ci skip] Fix direct/resolve documentation.Kasper Timm Hansen2017-02-211-11/+11
| | | | | | | | Use double quoted strings, come down hard on some typos.
| * Split direct method into twoAndrew White2017-02-212-49/+56
| | | | | | | | | | Use a separate method called `resolve` for the custom polymorphic mapping to clarify the API.
| * Push option extract into call methodAndrew White2017-02-212-8/+7
| |
| * Fix typo in exception messageAndrew White2017-02-211-1/+1
| |
| * Prefer remove_method over undef_methodAndrew White2017-02-211-4/+4
| | | | | | | | | | | | Using `undef_method` means that when a route is removed any other implementations of that method in the ancestor chain are inaccessible so instead use `remove_method` which restores access to the ancestor.
| * Support mapping of non-model classesAndrew White2017-02-211-3/+10
| |
| * Raise an error if `direct` is inside a scope blockAndrew White2017-02-211-3/+14
| |
| * Add custom polymorphic mappingAndrew White2017-02-213-56/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the use of `direct` to specify custom mappings for polymorphic_url, e.g: resource :basket direct(class: "Basket") { [:basket] } This will then generate the following: >> link_to "Basket", @basket => <a href="/basket">Basket</a> More importantly it will generate the correct url when used with `form_for`. Fixes #1769.
| * Don't allocate a hash unnecessarilyAndrew White2017-02-212-2/+6
| |
| * Only accept symbols and strings for Mapper#directAndrew White2017-02-211-1/+6
| |
| * Rename url_helper to directAndrew White2017-02-211-7/+7
| |
| * Add support for defining custom url helpers in routes.rbAndrew White2017-02-212-0/+116
| | | | | | | | | | | | | | | | | | | | | | Allow the definition of custom url helpers that will be available automatically wherever standard url helpers are available. The current solution is to create helper methods in ApplicationHelper or some other helper module and this isn't a great solution since the url helper module can be called directly or included in another class which doesn't include the normal helper modules. Reference #22512.
| * Wrap routes.url_helpers.url_for via a proxyAndrew White2017-02-211-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | The singleton url_for on Rails.application.routes.url_helpers isn't the same as the url_for you get when you include the module in your class as the latter has support for polymorphic style routes, etc. whereas the former accepts only a hash and is the underlying implementation defined on ActionDispatch::Routing::RouteSet. This commit changes the singleton method to call through a proxy instance so that it gets the full range of features specified in the documentation for url_for.
| * Tiny documentation edits [ci skip]Robin Dupret2017-02-211-1/+1
| |
| * Fix some grammar in docs [ci skip]kenta-s2017-02-211-1/+1
| |
| * Clean up documentationeileencodes2017-02-201-9/+10
| | | | | | | | | | There were some grammar issues and incorrect information in the system tests documentation.
| * Rename system_test_helper -> application_system_test_caseeileencodes2017-02-202-22/+9
| | | | | | | | | | | | This renames the system test helper file to be application system test case to match what the rest of Rails does. In the future we should consider changing the test_helper to match.
| * Fix default host in setup, move teardown to helper fileeileencodes2017-02-203-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Override integration test default host Integration tests automatically set the default host to 'http://example.com'. This works fine for integration tests because they are not real browser sessions, but doesn't work fine for system tests because they are real browser sessions. We can override this by setting the `host!` in `before_setup. The `Capybara.always_include_port` will allow the test to look at `127.0.0.1:port capybara picks` and properly redirect the test. Any application can override this by setting the `host!` in their system test helper. Generally though, applications are going to be using localhost. In this commit I also moved the setup and teardown into their own module for tidiness. * Move teardown settings into system test case These configuration options can be put into the system test case file instead of the generated system tests helper file. This is an implementation detail and therefore shouldn't be generated with the template.
| * Fix screenshot helper to provide correct file nameeileencodes2017-02-201-2/+6
| | | | | | | | | | We only want the file name to include the word `failures` if it failed, not any time the user wants to take a screenshot during a test run.
| * Move and rename system testseileencodes2017-02-205-0/+251
| | | | | | | | | | | | | | | | | | | | * Move system tests back into Action Pack * Rename `ActionSystemTest` to `ActionDispatch::SystemTestCase` * Remove private base module and only make file for public `SystemTestCase` class, name private module `SystemTesting` * Rename `ActionSystemTestCase` to `ApplicationSystemTestCase` * Update corresponding documentation and guides * Delete old `ActionSystemTest` files
* | Use of ParameterFilter no longer forces `request.filtered_parameters' class ↵Leonel Galan2017-02-132-2/+2
|/ | | | | | | | | | to be Hash - Fixes issue described on #27944 - `filtered_query_string` used an Array representation of what semantically is a key value pair: better suited for a Hash. Without this change `filtered_params = original_params.class.new` returns an Array with unintended consequences.
* Remove unused requireRyuta Kamizono2017-02-121-1/+0
| | | | | | These files are not using `strip_heredoc`. Closes #27976
* Removed the `attribute_accessors` required file:Edouard CHIN2017-02-121-1/+0
| | | | - This file is no more needed, the call to `cattr_reader` were removed in https://github.com/rails/rails/commit/9e2948e750fa3f641f20adad4b4ecae89b35faa7#diff-c5146df11f35304765e9ceebed108f57L60 and https://github.com/rails/rails/commit/1fe0a1b5ebebb1372968606b85ce08b93bc145c8#diff-c5146df11f35304765e9ceebed108f57L99
* Correct spellingBenjamin Fleischer2017-02-051-1/+1
| | | | | | | ``` go get -u github.com/client9/misspell/cmd/misspell misspell -w -error -source=text . ```
* Remove deprecated callbacks from ActionDispatch middlewaresRafael Mendonça França2017-01-313-61/+3
|
* Merge pull request #27647 from Shopify/fully-eagerload-journeyRafael França2017-01-304-0/+28
|\ | | | | Fully initialize routes before the first request is handled
| * Fully initialize routes before the first request is handledJean Boussier2017-01-184-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | `AD::Journey::GTG::Simulator` is lazily built the first time `Journey::Router#find_routes` is invoked, which happens when the first request is served. On large applications with many routes, building the simulator can take several hundred milliseconds (~700ms for us). Triggering this initialization during the boot process reduces the impact of deploys on the application response time.
* | Add examples for behaviour about redirection with and without options. Fixes ↵Vipul A M2017-01-211-0/+8
| | | | | | | | #27715 [ci skip] (#27730)
* | Add missing requireDavid Heinemeier Hansson2017-01-161-0/+1
| | | | | | | | This was preventing the test suite from being run in isolation
* | `respond_to_missing?` should fallback to `super` where method_missing could ↵Akira Matsuda2017-01-151-1/+1
| | | | | | | | call `super`
* | class Foo < Struct.new(:x) creates an extra unneeded anonymous classAkira Matsuda2017-01-131-1/+1
| | | | | | | | because Struct.new returns a Class, we just can give it a name and use it directly without inheriting from it
* | Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-124-7/+7
| | | | | | | | (I personally prefer writing one string in one line no matter how long it is, though)
* | Fix grammar in action_dispatch/http/parameters.rb [ci skip]kenta-s2017-01-111-1/+1
|/
* Current default Rails app encoding "utf-8" looks more like a W3C charset ↵Akira Matsuda2017-01-111-1/+1
| | | | than a ruby encoding
* Use already defined Encoding constant rather than freezing a StringAkira Matsuda2017-01-111-1/+1
|
* Make ActionDispatch::Request.parameter_parsers public APIRafael Mendonça França2017-01-111-1/+11
| | | | | | | It is the proper way to configure custom parameters parser and it was being recommended in the deprecation for ActionDispatch::ParamsParser. [ci skip]
* String#end_with? should be faster than Regexp hereAkira Matsuda2017-01-051-1/+1
|
* Remove deprecated ActionController::Metal.callRafael Mendonça França2017-01-031-9/+7
|
* fix with_routing when testing api only controllersJulia López2016-12-291-2/+5
|
* Use `next` instead of `break`; avoid terminating whole loopJon Moss2016-12-291-1/+1
| | | | | | | | | | | | | | We want to avoid terminating the whole loop here, because it will cause parameters that should be removed to not be removed, since we are terminating early. In this specific case, `param2` is processed before `param1` due to the reversing of `route.parts`, and since `param2` fails the check on this line, it would previously cause the whole loop to fail, and `param1` would still be in `parameterized_parts`. Now, we are simply calling `next`, which is the intended behavior. Introduced by 8ca8a2d773b942c4ea76baabe2df502a339d05b1. Fixes #27454.
* Use proper output format [ci skip] (#27498)प्रथमेश Sonpatki2016-12-291-1/+1
|
* Update request.rb --ci skipShardul Parab2016-12-291-0/+3
| | | | | | | | | | | | | | | | Documentation for ActionDispatch::Request#key? [ci skip] Update request.rb --ci skip Documentation for ActionDispatch::Request#key? [ci skip] Also made change after the review by @rafaelfranca . Update request.rb --ci skip Documentation for ActionDispatch::Request#key? [ci skip] Also made change after the review by @rafaelfranca . Update request.rb --ci skip
* Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-281-1/+1
| | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* Optimize Journey::Route#scoreBen Hughes2016-12-282-5/+14
| | | | | | | | Scoring routes based on constraints repeated many type conversions that could be performed in the outer loop. Determinations of score and fitness also used Array operations that required allocations. Against my benchmark with a large routeset, this reduced object allocations by over 30x and wall time by over 3x.