Commit Graph

10911 Commits

Author SHA1 Message Date
Frederick Cheung
3ed5104acf update comments to reflect that options support is not available 2014-03-25 14:02:22 +00:00
Vishal Lal
0ebae1dbc5 Swapped parameters of assert_equal in assert_select 2014-03-22 22:58:37 +00:00
David Heinemeier Hansson
9d44b3f886 Update test helper to use latest Digestor API 2014-03-21 19:39:08 +01:00
Godfrey Chan
3980d403ce The digest option is no longer honoured since Rails 3.0 [ci skip]
Closes #8513
2014-03-20 05:39:06 -07:00
Attila Domokos
102c556e0b Cleaning and adding tests for Session
Adding tests for Session `destroy`, `update` and `delete` methods. No changes for code under test.
2014-03-19 21:01:08 -05:00
Aaron Patterson
ba3ad256c6 Merge pull request #14090 from Fortisque/kevin/stream_error_in_main_thread_if_not_committed
re-raise error if error occurs before committing in streaming
2014-03-17 10:49:07 -07:00
Jeremy Kemper
cbc3b89c10 Add an explicit require for 4ece124396669d3580e7f229ab407a0d4882727a rather than assume SecureRandom is available 2014-03-16 16:08:16 -07:00
Jeremy Kemper
4ece124396 Avoid concurrent test collision on the same memcache server by namespacing keys 2014-03-16 16:06:27 -07:00
Andrew White
bb0518891c Use nested_scope? not shallow? to determine whether to copy options
The method `shallow?` returns false if the parent resource is a singleton so
we need to check if we're not inside a nested scope before copying the :path
and :as options to their shallow equivalents.

Fixes #14388.
2014-03-16 09:35:35 +00:00
Kevin Casey
933e9b4fe2 re-raise error if error occurs before committing in streaming
update the tests, using an if-else
2014-03-14 23:54:43 -07:00
Rafael Mendonça França
274d5e45e0 Merge pull request #14329 from pch/digestor-lookup-fix
Ensure LookupContext in Digestor selects correct variant
2014-03-14 14:58:34 -03:00
Łukasz Strzałkowski
f72feae9ba Don't pass variant in params, it's ignored
We're setting variant above, in request object directly
2014-03-13 17:53:11 +01:00
Aaron Patterson
3df07d093a use the body proxy to freeze headers
avoid freezing the headers until the web server has actually read data
from the body proxy.  Once the webserver has read data, then we should
throw an error if someone tries to set a header
2014-03-12 17:40:08 -07:00
Aaron Patterson
c0a783610f just ask the response for the commit status, we do not need to ask the jar 2014-03-12 16:21:01 -07:00
Aaron Patterson
77a09218f6 only write the jar if the response isn't committed
when streaming responses, we need to make sure the cookie jar is written
to the headers before returning up the stack. This commit introduces a
new method on the response object that writes the cookie jar to the
headers as the response is committed.  The middleware and test framework
will not write the cookie headers if the response has already been
committed.

fixes #14352
2014-03-12 16:07:26 -07:00
Yves Senn
7bbdb076c0 Merge pull request #14291 from laurocaetano/doc-for-original-fullpath
Add documentation for original_fullpath. [ci skip]
2014-03-12 08:41:45 +01:00
Lauro Caetano
0d191baa82 [ci skip] Add documentation for original_fullpath. 2014-03-11 20:11:53 -03:00
Andrew White
ec23277124 Merge pull request #14262 from sferik/flat_map
Replace additional instances of map.flatten with flat_map
2014-03-09 10:04:57 +00:00
Piotr Chmolowski
025c691536 Ensure LookupContext in Digestor selects correct variant
Related to: #14242 #14243 14293

Variants passed to LookupContext#find() seem to be ignored, so
I've used the setter instead: `finder.variants = [ variant ]`.

I've also added some more test cases for variants. Hopefully this
time passing tests will mean it actually works.
2014-03-09 08:47:17 +01:00
Carlos Antonio da Silva
45efd0ebf7 Move changelog entry to the top, highlight module name [ci skip] 2014-03-08 18:20:45 -03:00
Andrew White
af4c9b78ff Copy shallow options from normal options when using scope
If the options :shallow_prefix and :shallow_path are not set in the
scope options then copy them from the normal :as and :path options
if they are set.
2014-03-08 19:51:06 +00:00
Andrew White
8711086f5a Pull namespace defaults out of the options hash
If a developer has specified either :path or :as in the options hash then
these should be used as the defaults for :shallow_path and :shallow_prefix.

Fixes #14241.
2014-03-08 19:51:06 +00:00
Andrew White
dcc91a04a1 Only use shallow nested scope when depth is > 1
By tracking the depth of resource nesting we can push the need for nested
shallow scoping to only those routes that are nested more than one deep.
This allows us to keep the fix for #12498 and fix the regression in #14224.

Fixes #14224.
2014-03-08 19:51:06 +00:00
Andrew White
ed0fb4ae7e Move setting :scope_level_resource to resource_scope
Originally with_scope_level was exclusively for managing scope levels with
resources, however it is now used for other things so it makes more sense
to move the responsibility for setting the :scope_level_resource to the
resource_scope method. This eliminates repeatedly setting it to the same
resource as each resource method scope is evaluated.
2014-03-08 19:51:06 +00:00
Santiago Pastorino
2af7a7b19c Merge pull request #14280 from joho/make_csrf_failure_logging_optional
Make CSRF failure logging optional/configurable.
2014-03-08 15:22:42 -02:00
Vijay Dev
70ff31d69f Merge branch 'master' of github.com:rails/docrails
Conflicts:
	guides/source/4_1_release_notes.md
2014-03-07 20:58:11 +05:30
Aaron Patterson
b7192143ed Merge pull request #14285 from sikachu/master-revert-render-body-remove-content-type
Do note remove `Content-Type` when `render :body`
2014-03-06 08:22:43 -08:00
Prem Sichanugrist
2dd2fcf896
Introduce Rails.gem_version
This method return `Gem::Version.new(Rails.version)`, suggesting a more
reliable way to perform version comparison.

Example:

    Rails.version #=> "4.1.2"
    Rails.gem_version #=> #<Gem::Version "4.1.2">

    Rails.version > "4.1.10" #=> false
    Rails.gem_version > Gem::Version.new("4.1.10") #=> true
    Gem::Requirement.new("~> 4.1.2") =~ Rails.gem_version #=> true

This was originally introduced as `.version` by @charliesome in #8501
but got reverted in #10002 since it was not backward compatible.

Also, updating template for `rake update_versions`.
2014-03-05 12:37:38 -05:00
Prem Sichanugrist
ed88a601f7
Do note remove Content-Type when render :body
`render :body` should just not set the `Content-Type` header. By
removing the header, it breaks the compatibility with other parts.

After this commit, `render :body` will returns `text/html` content type,
sets by default from `ActionDispatch::Response`, and it will preserve
the overridden content type if you override it.

Fixes #14197, #14238

This partially reverts commit 3047376870d4a7adc7ff15c3cb4852e073c8f1da.
2014-03-05 10:33:52 -05:00
John Barton (joho)
67584c6ae3 Make CSRF failure logging optional/configurable.
Added the log_warning_on_csrf_failure option to ActionController::RequestForgeryProtection
which is on by default.
2014-03-05 11:31:57 +11:00
Piotr Chmolowski
1858cc6070 Variants in ActionView::Digestor
Take variants into account when calculating template digests in
ActionView::Digest.

Digestor#digest now takes a hash as an argument to support variants and
allow more flexibility in the future. Old-style arguments have been
deprecated.

Fixes #14242
2014-03-04 15:02:58 +01:00
Erik Michaels-Ober
817fe31196 Replace map.flatten with flat_map in actionpack 2014-03-03 19:23:12 -08:00
Shuhei Kagawa
38594b3527 Add spaces to deep_munge log message. 2014-03-03 22:39:15 +09:00
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
Zachary Scott
f302079d97 ✂️
This commit also addresses rails/docrails#169 and rails/rails#14159
2014-02-23 20:24:23 +11: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