aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | [close #23084] Deprecated StrongParametersschneems2016-01-191-0/+6
|/ / / / | | | | | | | | | | | | We can provide a more flexible upgrade experience by warning users they are using unsafe methods instead of forcing the safe API by deprecating before removal. This PR provides this functionality.
* | | | 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} ```
* | | | Merge pull request #22985 from akshay-vishnoi/fix-typoRafael França2016-01-161-1/+1
|\ \ \ \ | | | | | | | | | | test `include?`- fix typo
| * | | | test `include?`- fix typoAkshay Vishnoi2016-01-091-1/+1
| | | | |
* | | | | do not run in parallel on travisAaron Patterson2016-01-121-1/+5
| | | | |
* | | | | Merge pull request #22935 from cllns/add-status-name-to-outputRafael França2016-01-121-3/+16
|\ \ \ \ \ | | | | | | | | | | | | Add HTTP status name to output of tests
| * | | | | Add both HTTP Response Code and Type to assertion messagesSean Collins2016-01-121-3/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also, refactor logic to convert between symbol and response code, via the AssertionResponse class
* | | | | | Merge pull request #23035 from jkowens/fix-null-byteRafael França2016-01-121-0/+4
|\ \ \ \ \ \ | | | | | | | | | | | | | | Prevent static middleware from attempting to serve a request with a null byte
| * | | | | | Prevent attempt to serve a request with a null byteJordan Owens2016-01-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | File paths cannot contain null byte characters and methods that do path operations such as Rack::Utils#clean_path_info will raise unwanted errors.
* | | | | | | AC::Parameters#at_json: restore Rails 4.2’s valueclaudiob2016-01-121-0/+6
| |/ / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #23026 See discussion at #23026
* | | | | | Commit before freezing the headersMatthew Draper2016-01-121-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This shouldn't generally come up: under a standard flow, we don't start sending until after the commit. But application code always finds a way.
* | | | | | Merge pull request #21181 from denisenkom/mypatchKasper Timm Hansen2016-01-101-0/+19
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Test basic auth with symbols in password
| * | | | | Test basic auth with symbols in login and passwordMikhail Denisenko2015-10-241-0/+19
| | | | | |
* | | | | | 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
* | | | | | Remove splat operator warning from ssl_testPrathamesh Sonpatki2016-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Removes following warning - `rails/actionpack/test/dispatch/ssl_test.rb:203: warning: `*' interpreted as argument prefix`.
* | | | | | Allow AC::Parameters as an argument to url_helpersPrathamesh Sonpatki2016-01-071-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Earlier only Hash was allowed as params argument to url_helpers. - Now ActionController::Parameters instances will also be allowed. - If the params are not secured then it will raise an ArgumentError to indicate that constructing URLs with non-secure params is not recommended. - Fixes #22832.
* | | | | | Merge pull request #22275 from mastahyeti/per-form-csrfRafael França2016-01-061-0/+172
|\ \ \ \ \ \ | | | | | | | | | | | | | | Per-form CSRF tokens
| * | | | | | add option for per-form CSRF tokensBen Toews2016-01-041-0/+172
| | | | | | |
* | | | | | | Merge pull request #22906 from bf4/rendering_exceptionsRafael França2016-01-042-24/+90
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | Add ActionController:Renderers test
| * | | | | | Add ActionController:Renderers testBenjamin Fleischer2016-01-032-24/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | To complement actionpack/test/controller/metal/renderers_test.rb
* | | | | | | Fix typo in test desctiption [skip ci]Anton Davydov2016-01-041-1/+1
|/ / / / / /
* | / / / / Test ActionController::Renderers::use_renderersBenjamin Fleischer2015-12-312-0/+48
| |/ / / / |/| | | |
* | | | | Merge pull request #22850 from prathamesh-sonpatki/fix_ac_params_unsafe_h_2Kasper Timm Hansen2015-12-311-0/+8
|\ \ \ \ \ | | | | | | | | | | | | Fix AC::Parameters#to_unsafe_h to return all unfiltered values
| * | | | | Fix AC::Parameters#to_unsafe_h to return all unfiltered valuesPrathamesh Sonpatki2015-12-311-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - AC::Parameters#convert_parameters_to_hashes should return filtered or unfiltered values based on whether it is called from `to_h` or `to_unsafe_h` instead of always defaulting to `to_h`. - Fixes #22841
* | | | | | Merge pull request #22826 from timrogers/actiondispatch-ssl-configRafael França2015-12-311-15/+30
|\ \ \ \ \ \ | |_|_|_|_|/ |/| | | | | Configurable redirect and secure cookies for ActionDispatch::SSL
| * | | | | Flexible configuration for ActionDispatch::SSLTim Rogers2015-12-291-15/+30
| | |_|_|/ | |/| | |
* | | | | Fix test for AC::Parameters#to_unsafe_hPrathamesh Sonpatki2015-12-301-2/+2
| |/ / / |/| | | | | | | | | | | - Test should call `to_unsafe_h` instead of `to_h`
* | | | Merge pull request #22830 from jcoyne/parameters_includeRichard Schneeman2015-12-291-0/+6
|\ \ \ \ | | | | | | | | | | Add AC::Parameters#include?
| * | | | Add AC::Parameters#include?Justin Coyne2015-12-291-0/+6
| |/ / / | | | | | | | | | | | | Fixes #22818
* | | | Format from Accept headers have higher precedence than path extension formatJorge Bejar2015-12-291-0/+9
| | | |
* | | | Rely on default Mime format when MimeNegotiation#format_from_path_extension ↵Jorge Bejar2015-12-291-0/+12
|/ / / | | | | | | | | | | | | | | | is not a valid type Closes #22747
* | | Currectly test the Middleware#==Rafael Mendonça França2015-12-221-4/+8
| | |
* | | Add #== back to ActionDispatch::MiddlewareStack::MiddlewareJon Moss2015-12-211-0/+12
| |/ |/| | | | | | | This was causing bug #22738 to occur. Also added extra tests to make sure everything is A-OK.
* | Merge pull request #22650 from derekprior/dp-actionpack-warningsRafael França2015-12-181-0/+5
|\ \ | | | | | | Fix "instance variable not initialized" in tests
| * | Fix "instance variable not initialized" in testsDerek Prior2015-12-171-0/+5
| | | | | | | | | | | | | | | | | | | | | The ActionPack test suite had a handful of these warnings when run. This was due to `assert_response` being tested outside the context of a controller instance where those instance variables would already have been initialized.
* | | Merge pull request #20797 from byroot/prevent-url-for-ac-parametersRafael França2015-12-183-3/+10
|\ \ \ | |/ / |/| | Prevent ActionController::Parameters in url_for
| * | Prevent ActionController::Parameters from being passed to url_for directlyJean Boussier2015-12-153-3/+10
| | |
* | | Only dup Ruby's Hash and Array.Kasper Timm Hansen2015-12-171-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | When calling `to_h` on an `ActionController::Parameters` instance it would `deep_dup` its internal parameters. This inadvertently called `dup` on a passed Active Record model which would create new models. Fix by only dupping Ruby's Arrays and Hashes.
* | | Deprecate `redirect_to :back`Derek Prior2015-12-161-2/+15
| | | | | | | | | | | | | | | | | | | | | Applications that use `redirect_to :back` can be forced to 500 by clients that do not send the HTTP `Referer` (sic) header. `redirect_back` requires the user to consider this possibility up front and avoids this trivially-caused application error.
* | | Add `redirect_back` for safer referrer redirectsDerek Prior2015-12-161-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `redirect_to :back` is a somewhat common pattern in Rails apps, but it is not completely safe. There are a number of circumstances where HTTP referrer information is not available on the request. This happens often with bot traffic and occasionally to user traffic depending on browser security settings. When there is no referrer available on the request, `redirect_to :back` will raise `ActionController::RedirectBackError`, usually resulting in an application error. `redirect_back` takes a required `fallback_location` keyword argument that specifies the redirect when the referrer information is not available. This prevents 500 errors caused by `ActionController::RedirectBackError`.
* | | deletes code commented out in 72160d9fTony Ta2015-12-151-10/+0
| | |
* | | Merge pull request #14212 from tylerhunt/fix-token-regexSean Griffin2015-12-151-0/+8
|\ \ \ | | | | | | | | | | | | Handle tab in token authentication header.
| * | | Handle tab in token authentication header.Tyler Hunt2014-02-261-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The HTTP spec allows for LWS to precede the header content, which could include multiple SP and HT characters. Update the regex used to match the Token authorization header to account for this, instead of matching on a single SP. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html and http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html for the relevant parts of the specification.
* | | | Add fragment_cache_key macro for controller-wide fragment cache key prefixesSam Stephenson2015-12-141-0/+25
| | | |
* | | | Merge pull request #22564 from maximeg/legit_name_errorsSean Griffin2015-12-141-0/+41
|\ \ \ \ | | | | | | | | | | Don't catch all NameError to reraise as ActionController::RoutingError
| * | | | Don't catch all NameError to reraise as ActionController::RoutingError #22368Maxime Garcia2015-12-121-0/+41
| | |/ / | |/| |
* / | | Make Parameters#to_h and #to_unsafe_h return HWIAPrem Sichanugrist2015-12-141-4/+4
|/ / / | | | | | | | | | | | | | | | | | | This makes these two methods to be more inline with the previous behavior of Parameters as Parameters used to be inherited from HWIA. Fixes #21391
* | | Show redirect response code in assert_response messagesJon Atack2015-12-111-7/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow-up to PR #19977, which helpfully added the redirection path to the error message of assert_response if response is a redirection, but which removed the response code, obscuring the type of redirect. This PR: - brings back the response code in the error message, - updates the tests so the new messages can be tested, - and adds test cases for the change.
* | | Merge pull request #22514 from ↵Rafael França2015-12-111-2/+2
|\ \ \ | | | | | | | | | | | | | | | | prathamesh-sonpatki/use-assert-over-assert-predicate Use assert over assert_predicate in assert_response
| * | | Use assert over assert_predicate in assert_responsePrathamesh Sonpatki2015-12-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - `assert_predicate` appends its own error message at the end of message generated by `assert_response` and because of that the error message displays the whole `response` object. - For eg. Expected response to be a <success>, but was a redirect to <http://test.host/posts>. Expected #<ActionDispatch::TestResponse:0x007fb1cc1cf6f8....(lambda)>}>> to be successful?. - Complete message can be found here - https://gist.github.com/prathamesh-sonpatki/055afb74b66108e71ded#file-gistfile1-txt-L19. - After this change the message from `assert_predicate` won't be displayed and only message generated by `assert_response` will be shown as follows: Expected response to be a <success>, but was a redirect to <http://test.host/posts>