aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_dispatch/testing/test_request.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use tt in doc for ActionPack [ci skip]Yoshiyuki Hirano2017-08-261-1/+1
|
* 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
|
* [docs] fix ActionDispatch documentationHrvoje Šimić2017-03-131-1/+1
|
* Fix memoization bug on ActionDispatch::TestRequest#request_method=Kir Shatrov2016-09-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | TestRequest have been overrriding request_method setter since 2009, but the actual implementation in Request (not TestRequest) has been changed since that. Now it's also using @request_method instance variable to keep the state. The override in TestRequest have not been calling `super`, which caused a bug that after accessing #requst_method the value was memoized and then we've never been able to change it anymore: ``` req = ActionDispatch::TestRequest.create puts "was: #{req.request_method}" # memoized here req.request_method = "POST" puts "became: #{req.request_method}" ``` output: ``` was: GET became: GET ``` Since the whole purpose of overriding the setter in TestRequest is to upcase it, I'm changing it to `super(method.to_s.upcase)`
* applies new string literal convention in actionpack/libXavier Noria2016-08-061-17/+17
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Remove last uses of `@env[]` and `@env[]=`Jon Moss2016-04-281-11/+11
| | | | | | | | | Last August (2015), @tenderlove worked to remove all `@env[]` and `@env[]=`, in favor of using `set_header`, `get_header`, etc. (Here's an [example commit](https://github.com/rails/rails/commit/f16a33b68efc3dc57cfafa27651b9a765e363fbf)). This PR should remove the last uses of these methods, and fully convert them to the newly standardized API.
* assign the cookie hash on request allocationAaron Patterson2015-07-081-1/+1
| | | | this prevents mutations from being available globally
* add a new constructor for allocating test requestsAaron Patterson2015-07-081-8/+8
|
* make `env` a required parameterAaron Patterson2015-07-081-1/+1
|
* remove useless `new` implementationAaron Patterson2015-07-081-4/+0
|
* pass cookies from the jar in the HTTP_COOKIE headereileencodes2015-07-071-9/+4
| | | | | we should be pushing the cookies in via headers rather than maintaining some object and "recycling" it.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Remove symbolized_path_parameters.Guo Xiang Tan2014-07-021-1/+1
| | | | This pull request is a continuation of https://github.com/rails/rails/commit/925bd975 and https://github.com/rails/rails/commit/8d8ebe3d.
* Allow overriding of all headers from passed environment hashAndrew White2013-07-251-5/+5
| | | | | | | Allow REMOTE_ADDR, HTTP_HOST and HTTP_USER_AGENT to be overridden from the environment passed into `ActionDispatch::TestRequest.new`. Fixes #11590
* load active_support/core_ext/object/blank in active_support/railsXavier Noria2012-08-021-1/+0
|
* make the default environment have actual defaultsAaron Patterson2012-07-031-1/+7
| | | | | | instead of deleting keys on every instantiation, create defaults we actually use. eventually we can pass an environment in to the request, and create a new req / res object on each call.
* Fix bug when Rails.application is defined but is nil. See #881Marc-Andre Lafortune2012-05-211-1/+1
|
* Remove not needed requiresSantiago Pastorino2012-03-311-1/+0
|
* Add backward compatibility for testing cookiesAndrew White2011-06-051-1/+7
| | | | | | | | | | | | | | | | | | | This commit restores the ability to assign cookies for testing via @request.env['HTTP_COOKIE'] and @request.cookies, e.g: @request.env['HTTP_COOKIE'] = 'user_name=david' get :index assert_equal 'david', cookies[:user_name] and @request.cookies[:user_name] = 'david' get :index assert_equal 'david', cookies[:user_name] Assigning via cookies[] is the preferred method and will take precedence over the other two methods. This is so that cookies set in controller actions have precedence and are carried over between calls to get, post, etc.
* Refactor ActionController::TestCase cookiesAndrew White2011-06-041-25/+0
| | | | | | | | | | | | | | | | | | Assigning cookies for test cases should now use cookies[], e.g: cookies[:email] = 'user@example.com' get :index assert_equal 'user@example.com', cookies[:email] To clear the cookies, use clear, e.g: cookies.clear get :index assert_nil cookies[:email] We now no longer write out HTTP_COOKIE and the cookie jar is persistent between requests so if you need to manipulate the environment for your test you need to do it before the cookie jar is created.
* Improve testing of cookies in functional tests:Andrew White2011-03-061-1/+6
| | | | | | | | | - cookies can be set using string or symbol keys - cookies are preserved across calls to get, post, etc. - cookie names and values are escaped - cookies can be cleared using @request.cookies.clear [#6272 state:resolved]
* Initialize @cookies.Emilio Tagua2010-09-271-0/+1
|
* Don't shadow outer local variables.Emilio Tagua2010-09-271-1/+1
|
* Added ability to set asset_path for enginesPiotr Sarnacki2010-09-031-1/+1
|
* Rename config.cookie_secret to config.secret_token and pass it as ↵José Valim2010-04-051-0/+2
| | | | configuration in request.env. This is another step forward removing global configuration.
* adds missing requires for Object#blank? and Object#present?Xavier Noria2010-03-281-0/+2
|
* Switch functional tests to run through the rack interface instead of processJoshua Peek2009-05-021-0/+5
|
* Move TestRequest#query_parameters into AD TestRequestJoshua Peek2009-04-301-0/+4
|
* Move TestRequest cookies accessor into AD TestRequestJoshua Peek2009-04-301-3/+21
|
* Start moving TestRequest and TestResponse into ActionDispatchJoshua Peek2009-04-301-0/+56