1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
Commit graph

18 commits

Author SHA1 Message Date
Guo Xiang Tan
cb5f2d3215 Remove symbolized_path_parameters.
This pull request is a continuation of https://github.com/rails/rails/commit/925bd975 and https://github.com/rails/rails/commit/8d8ebe3d.
2014-07-02 16:05:55 -07:00
Andrew White
4db0637d55 Allow overriding of all headers from passed environment hash
Allow REMOTE_ADDR, HTTP_HOST and HTTP_USER_AGENT to be overridden from
the environment passed into `ActionDispatch::TestRequest.new`.

Fixes #11590
2013-07-25 07:54:57 +01:00
Xavier Noria
8f58d6e507 load active_support/core_ext/object/blank in active_support/rails 2012-08-02 21:59:22 +02:00
Aaron Patterson
142d50e52e make the default environment have actual defaults
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.
2012-07-03 17:37:47 -07:00
Marc-Andre Lafortune
89ebd28d4e Fix bug when Rails.application is defined but is nil. See #881 2012-05-21 15:24:18 -04:00
Santiago Pastorino
67b000ebd5 Remove not needed requires 2012-03-31 15:13:35 -03:00
Andrew White
e864ff7259 Add backward compatibility for testing cookies
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.
2011-06-05 12:34:27 +01:00
Andrew White
d4658d86fe Refactor ActionController::TestCase cookies
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.
2011-06-04 07:09:11 +01:00
Andrew White
31f09f9dbc Improve testing of cookies in functional tests:
- 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]
2011-03-06 12:49:44 +00:00
Emilio Tagua
1ed18fcc91 Initialize @cookies. 2010-09-27 11:19:23 -03:00
Emilio Tagua
dafb4bd33b Don't shadow outer local variables. 2010-09-27 11:19:22 -03:00
Piotr Sarnacki
a132229d7b Added ability to set asset_path for engines 2010-09-03 22:59:08 +02:00
José Valim
6690d66292 Rename config.cookie_secret to config.secret_token and pass it as configuration in request.env. This is another step forward removing global configuration. 2010-04-05 12:00:24 +02:00
Xavier Noria
76f024ac8d adds missing requires for Object#blank? and Object#present? 2010-03-28 14:15:02 +02:00
Joshua Peek
f32cf44870 Switch functional tests to run through the rack interface instead of process 2009-05-02 15:29:18 -05:00
Joshua Peek
1fcc7dbcc8 Move TestRequest#query_parameters into AD TestRequest 2009-04-30 23:46:34 -05:00
Joshua Peek
a6fff94baf Move TestRequest cookies accessor into AD TestRequest 2009-04-30 19:23:50 -05:00
Joshua Peek
00d1a57e9f Start moving TestRequest and TestResponse into ActionDispatch 2009-04-30 17:26:03 -05:00