Commit Graph

10877 Commits

Author SHA1 Message Date
Zachary Scott
11e815e938 Refactor tests from BaseRackTest into BaseRequestTest 2014-03-01 15:38:47 -08:00
Erik Michaels-Ober
b11ebf1d80 Replace map.flatten(1) with flat_map 2014-02-28 22:46:25 -08:00
Aaron Patterson
401787db4b make sure we wait for the threads to shut down before asserting closure 2014-02-28 16:35:33 -08:00
Aaron Patterson
a7b059ec7f use built-in exception handling in live controllers
when an exception happens in an action before the response has been
committed, then we should re-raise the exception in the main thread.
This lets us reuse the existing exception handling.
2014-02-28 15:39:08 -08:00
Aaron Patterson
30d21dfcb7 live controllers should have live responses
detect the type of controller we're testing and return the right type of
response based on that controller.  This allows us to stop doing the
weird sleep thing.
2014-02-28 15:22:43 -08:00
Aaron Patterson
9af4258186 set the error callback to a nice default in case nobody set an error callback and an error happens 2014-02-28 11:57:15 -08:00
Tony Wooster
a351149e80 Fix controller test not resetting @_url_options
Commit 4f2cd3e9 introduced a bug by reordering the call to
`@controller.recycle!` above the call to `build_request_uri`. The
impact of this was that the `@_url_options` cache ends up not being
reset between building a request URI (occurring within the test
controller) and the firing of the actual request.

We encountered this bug because we had the following setup:

  class MinimumReproducibleController < ActionController::Base
    before_filter { @param = 'param' }

    def index
      render text: url_for(params)
    end

    def default_url_options
      { custom_opt: @param }
    end
  end

  def test_index
    get :index # builds url, then fires actual request
  end

The first step in  `get :index` in the test suite would populate the
@_url_options cache. The subsequent call to `url_for` inside of the
controller action would then utilize the uncleared cache, thus never
calling the now-updated default_url_options.

This commit fixes this bug calling recycle! twice, and removes a call
to set response_body, which should no longer be needed since we're
recycling the request object explicitly.
2014-02-26 10:39:44 -08:00
Carlos Antonio da Silva
71b3910a7d Point master changelogs to 4-1-stable branch
Remove 4-1 related entries from master [ci skip]
2014-02-25 09:14:36 -03:00
Yves Senn
06f815e61c ActionDispatch::Head was replaced by Rack::Head. Closes #14191.
See 449039a86d802871b707dfb51ac1ed96d53526f9 for the original commit.
2014-02-25 11:20:12 +01:00
Serj L
88cfeca16a Simple Sungularize ActionController::UnpermittedParameters error in case when only 1 parameter is unpermitted. 2014-02-24 13:25:38 +04:00
Yves Senn
c554d170e6 update version to 4.2.0.alpha 2014-02-23 13:14:43 +01:00
Joan Karadimov
f6d9b68997 Check if the request variable isn't nil when calling render_to_string
closes #14125
2014-02-20 20:53:47 +02:00
robertomiranda
e220a34e39 Update Docs in favor to use render plain instead of text option
ref #14062
2014-02-18 15:05:10 -05:00
Rafael Mendonça França
1879c259b8 Merge branch '4-1-0-beta2'
Conflicts:
	actionview/CHANGELOG.md
	activerecord/CHANGELOG.md
2014-02-18 16:00:47 -03:00
Rafael Mendonça França
8b20c72dd8 Preparing for 4.1.0.beta2 release 2014-02-18 15:45:20 -03:00
Prem Sichanugrist
3047376870 Add #no_content_type attribute to AD::Response
Setting this attribute to `true` will remove the content type header
from the request. This is use in `render :body` feature.
2014-02-18 12:11:41 -05:00
Prem Sichanugrist
79c4983f89 Cleanup ActionController::Rendering 2014-02-18 12:08:36 -05:00
Prem Sichanugrist
920f3ba266 Introduce render :html for render HTML string
This is an option for to HTML content with a content type of
`text/html`. This rendering option calls `ERB::Util.html_escape`
internally to escape unsafe HTML string, so you will have to mark your
string as html safe if you have any HTML tag in it.

Please see #12374 for more detail.
2014-02-18 12:08:36 -05:00
Prem Sichanugrist
8cd9f6d205 Introduce render :plain for render plain text
This is as an option to render content with a content type of
`text/plain`. This is the preferred option if you are planning to render
a plain text content.

Please see #12374 for more detail.
2014-02-18 12:08:36 -05:00
Prem Sichanugrist
9e9cc66077 Update hash format for render_text_test 2014-02-18 12:08:36 -05:00
Prem Sichanugrist
103e18c87d Introduce render :body for render raw content
This is an option for sending a raw content back to browser. Note that
this rendering option will unset the default content type and does not
include "Content-Type" header back in the response.

You should only use this option if you are expecting the "Content-Type"
header to not be set. More information on "Content-Type" header can be
found on RFC 2616, section 7.2.1.

Please see #12374 for more detail.
2014-02-18 12:08:36 -05:00
KalabiYau
4e84e12a8e Fix parameter naming in RemoteIp middleware constructor method
Was custom_proxies in inline docs, but should be and defined in
constructor as custom_proxies
2014-02-18 15:52:56 +01:00
Kevin Casey
8508346dd0 Correct prestreaming controller response status.
if the controller action has not yet streamed any data, actions should
process as normal, and errors should trigger the appropriate behavior
(500, or in the case of ActionController::BadRequest, a 400 Bad Request)
2014-02-15 13:05:00 -08:00
David Heinemeier Hansson
bfc34fc005 No variant should also be picked up by variant.any if variant.none is not defined (just like any other variant) 2014-02-13 20:44:10 +01:00
Łukasz Strzałkowski
00a4af9ab7 Check if variant array contains only symbols 2014-02-13 18:05:55 +01:00
Lukasz Strzalkowski
f9b6b865e6 Variant negotiation
Allow setting `request.variant` as an array - an order in which they will be
rendered.

For example:

  request.variant = [:tablet, :phone]

  respond_to do |format|
    format.html.none
    format.html.phone # this gets rendered
  end
2014-02-13 16:22:56 +01:00
Godfrey Chan
dafc0eef4d rm warning about variable shadowing 2014-02-11 03:56:35 -08:00
Godfrey Chan
7a3ef9842b Migrate hash-based cookie values correctly 2014-02-11 02:56:03 -08:00
Godfrey Chan
0b86a6e950 Updated CHANGELOG, docs, guides and release notes.
Also added a `cookies_serializer.rb` initializer to the app template.
2014-02-11 02:52:07 -08:00
Godfrey Chan
ecf04f19b0 Added changelog entry for Flash changes [ci skip] 2014-02-11 01:54:58 -08:00
Godfrey Chan
9fc7a6fced Missed FlashHash#replace 2014-02-11 01:54:18 -08:00
Godfrey Chan
b97e087321 Fixed broken flash tests 2014-02-11 01:54:17 -08:00
Godfrey Chan
ead947a3b2 Re-write legacy (marshal) cookies on read 2014-02-11 01:54:17 -08:00
Guillermo Iguaran
a668beffd6 Stringify the incoming hash in FlashHash
Stringify the incoming as well to handle incoming symbol keys from
marshalled sessions
2014-02-11 01:54:17 -08:00
Guillermo Iguaran
a6ce984b49 Convert FlashHash in a Hash with indifferent access 2014-02-11 01:54:17 -08:00
Godfrey Chan
ba6861d032 Changed the tests to ensure HybridSerializer actually migrates the cookies (currently failing) 2014-02-11 01:54:17 -08:00
Godfrey Chan
6de4888e04 Fixed minor typo in test code 2014-02-11 01:54:17 -08:00
Rafael Mendonça França
d4b7aa735a Tests for the HybridSerializer 2014-02-11 01:54:17 -08:00
Godfrey Chan
25f68ac6a2 Removed an old test 2014-02-11 01:54:17 -08:00
Godfrey Chan
fafe8ece9d Added HybridSerializer to upgrade existing marshal cookies (wip: need tests) 2014-02-11 01:54:16 -08:00
Godfrey Chan
54641fa2e3 Just very so slightly better test coverage 2014-02-11 01:54:16 -08:00
Godfrey Chan
b927d67dec Renamed session_serializer option to cookies_serializer 2014-02-11 01:54:16 -08:00
Yves Senn
3b868cc99d docs, link to HTTP and CGI header definitions. [ci skip]
This was a reaction to: https://github.com/rails/rails/pull/9700#issuecomment-34550210
2014-02-10 15:51:51 +01:00
Andrew White
462d7cb314 Set the :shallow_path as each scope is generated
If we set :shallow_path when shallow is called it can result in incorrect
paths if the resource is inside a namespace because namespace itself sets
the :shallow_path option to the namespace path.

We fix this by removing the :shallow_path option from shallow as that should
only be turning shallow routes on and not otherwise affecting the scope.
To do this we need to treat the :shallow option to resources differently to
other scope options and move it to before the nested block is called.

This change also has the positive side effect of making the behavior of the
:shallow option consistent with the shallow method.

Fixes #12498.
2014-02-09 10:46:07 -08:00
Vijay Dev
92fdd65162 Merge branch 'master' of github.com:rails/docrails
Conflicts:
	guides/source/active_record_validations.md
	guides/source/api_documentation_guidelines.md
	guides/source/configuring.md
2014-02-09 23:33:55 +05:30
Aaron Patterson
33be58b206 Merge pull request #13982 from dskang/fix-response-flatten-infinite-recursion
Fix response flatten infinite recursion
2014-02-09 08:50:28 -08:00
Rafael Mendonça França
a5ee843d91 Merge pull request #13990 from zzak/ap_dont_autoload_filter_parameters
FilterParameters is referenced at the class level from the Request
2014-02-09 11:58:10 -02:00
Carlos Antonio da Silva
e08514e822 Merge pull request #13985 from zzak/remove_old_todo_in_url_for_test
Remove outdated TODO from url_for test, this test was fixed in 900a2d30
2014-02-09 11:49:18 -02:00
Zachary Scott
8d7923b7eb FilterParameters is referenced at the class level from the Request
Since it's already required in the file, we don't need to use autoload
too. This commit is symmetrical change to 0b10180 for Response.
2014-02-09 11:30:49 +02:00
SHIBATA Hiroshi
a09c07890a use File.exist? instead of File.exists? 2014-02-09 17:39:55 +09:00