aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch
Commit message (Collapse)AuthorAgeFilesLines
...
| * 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.
* Shave a couple of allocations off Journey scan & parseMatthew Draper2016-12-253-203/+207
|
* Privatize unneededly protected methods in Action PackAkira Matsuda2016-12-248-49/+49
|
* No need to nodoc private methodsAkira Matsuda2016-12-242-18/+18
|
* Describe what we are protectingAkira Matsuda2016-12-231-0/+2
|
* Document and update API for `skip_parameter_encoding`Aaron Patterson2016-12-213-11/+17
| | | | | | | | This commit changes `parameter_encoding` to `skip_parameter_encoding`. `skip_parameter_encoding` will set encoding on all parameters to ASCII-8BIT for a given action on a particular controller. This allows the controller to handle data when the encoding of that data is unknown, for example file systems or truly binary parameters.
* Only default the response charset when it is first setMatthew Draper2016-12-201-1/+3
| | | | | If it is explicitly cleared (e.g., response.sending_file = true), then we should not try to set it again.
* Do not raise exception when content_type is a empty stringRafael Mendonça França2016-12-091-1/+1
| | | | | When content type header is blank we were raising an exception because `empty?` was being called on nil.
* Only move fixture_file_upload to IntegrationTestMatthew Draper2016-12-072-18/+22
| | | | | The rest of the helpers are better placed on Session -- and this is the only one that cares which class it is defined on.
* [ci skip] Update the `as` docs.Kasper Timm Hansen2016-11-271-1/+2
| | | | Mention the Accept header and how that figures into the request format.
* Remove default argument value.Kasper Timm Hansen2016-11-271-1/+1
| | | | Wrongly added when fixing the request path wrangling.
* [ci skip] Explain only :json is shipped by default.Kasper Timm Hansen2016-11-231-1/+2
| | | | | | | Don't want to add defensive programming to this fairly simple thing. Fixes #27060.
* Use accept header instead of mangling request path.Kasper Timm Hansen2016-11-232-22/+19
| | | | | | | | | | | | | | Instead of appending a format to the request, it's much better to just pass a more appropriate accept header. Rails will figure out the format from that instead. This allows devs to use `:as` on routes that don't have a format. Introduce an `IdentityEncoder` to avoid `if request_encoder`, essentially a better version of the purpose of the `WWWFormEncoder`. One that makes conceptual sense on GET requests too. Fixes #27144.
* Revert "fix typo in `match` doc [ci skip]"Jon Moss2016-11-191-1/+1
|
* fix typo in `match` doc [ci skip]yuuji.yaginuma2016-11-201-1/+1
| | | | s/Constrains/Constraints
* Merge pull request #27089 from erickueen/erickueen_fix_26606Rafael Mendonça França2016-11-181-5/+5
|\ | | | | | | Fix incorrect output from rails routes when using singular resources …
| * Fix incorrect output from rails routes when using singular resources issue ↵Erick Reyna2016-11-181-5/+5
| | | | | | | | | | | | | | | | | | | | #26606 Rails routes (even rake routes in previous versions) output showed incorrect routes when an application use resource :controller, implying that edit_controller_path match with controller#show. The order of the output has changed to correct this. View #26606 for more information. Added a test case, change unit test in rake to expect the new output. Since the output of resource :controller is changing, the string spected of the railties/test/application/rake_test.rb test_rails_routes_with_controller_environment had to be modified.
* | Fix `ActionDispatch::IntegrationTest#open_session`Tawan Sierek2016-11-181-0/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reset a new session directly after its creation in `ActionDispatch::IntegrationTest#open_session`. Reset the session to a clean state before making it available to the client's test code. Issue #22742 reports unexpected behavior of integration tests that run multiple sessions. For example an `ActionDispatch::Flash` instance is shared across multiple sessions, though a client code will rightfully assume that each new session has its own flash hash. The following test failed due to this behavior: class Issue22742Test < ActionDispatch::IntegrationTest test 'issue #22742' do integration_session # initialize first session a = open_session b = open_session refute_same(a.integration_session, b.integration_session) end end Instead of creating a new `ActionDispatch::Integration::Session` instance, the same instance is shared across all newly opened test sessions. This is due to the way how new test sessions are created in `ActionDispatch::IntegrationTest#open_session`. The already existing `ActionDispatch::IntegrationTest` instance is duplicated with `Object#dup`, This approach was introduced in commit 15c31c7639b. `Object#dup` copies the instance variables, but not the objects they reference. Therefore this issue only occurred when the current test instance had been tapped in such a way that the instance variable `@integration_session` was initialized before creating the new test session. Close #22742 [Tawan Sierek + Sina Sadeghian]
* Missing require string/filters for `squish`Akira Matsuda2016-11-151-0/+2
|
* Merge pull request #27007 from maclover7/jm-fix-26912Rafael Mendonça França2016-11-131-2/+2
|\ | | | | | | Don't error on an empty CONTENT_TYPE
| * Don't error on an empty CONTENT_TYPEJon Moss2016-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit prevents a possible issue wherein an empty CONTENT_TYPE header is sent in a request to a Rails application, and then `request.content_mime_type` would return `nil`. This is because the `has_content_type?` guard method was not properly checking the validity of a request's content type; it was only checking to see whether or not the header existed, not whether it had a value stored inside. Relatedly, after an internal discussion, it was determined that the `has_content_type?` method is not meant to be part of the public API, and is therefore changed to a `:nodoc:` method in this commit. The test for this behavior is a little bit ugly, for two reasons. One is that it was difficult to determine where to place the test... I figured the best place would be with the rest of the ParamsWrapper stuff, since that's where the original issue was. Also, we have to do some fancy footwork in calling `dispatch` on the test's controller manually... this is because `ActionController::TestCase` will throw an error if you try and pass in a nil content type, which is exactly what we are trying to test here... Because of that, we have to manually call in to the controller, and bypass the `post` request helper. Fixes #26912. This is a regression in behavior between Rails versions 4.2.x and 5.0.x, which was introduced via [this commit](https://github.com/rails/rails/commit/a9f28600e901b11a9222e34bfae8642bfb753186).
* | Merge pull request #26222 from vipulnsward/26134-fixRafael França2016-11-131-1/+5
|\ \ | | | | | | Format and send logs to logger.fatal from DebugExceptions
| * | Format and send logs to logger.fatal from DebugExceptions instead of calling ↵Vipul A M2016-11-121-1/+5
| |/ | | | | | | | | | | fatal multiple times. Expose tags_text from TaggedLogging to be used for log formatting Fixes #26134