aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/live_stream_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-1/+1
|
* Introduced `ActiveSupport::Digest` that allows to specify hash function ↵Dmitri Dolguikh2017-12-121-1/+1
| | | | | | | | implementation and defaults to `Digest::MD5`. Replaced calls to `::Digest::MD5.hexdigest` with calls to `ActiveSupport::Digest.hexdigest`.
* Fix RuboCop offensesKoichi ITO2017-08-161-2/+2
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* 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
|
* Define path with __dir__bogdanvlviv2017-05-231-1/+1
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Add more missing requiresAndrew White2017-02-221-0/+1
| | | | Further missing requires for Timeout exposed due to Bundler 1.14.5
* Silence a warningRafael Mendonça França2016-10-071-1/+3
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-2/+2
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Fix deadlock that can occur when child live thread tries to load a constant ↵Alex Chinn2016-08-151-0/+22
| | | | after writing to the stream.
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-3/+3
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-51/+51
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Merge pull request #24029 from ↵Sean Griffin2016-05-061-1/+2
|\ | | | | | | | | | | | | rthbound/dont-call-each-when-calling-body-on-response Dont call each when calling body on response to fix #23964 Fixes #23964
| * Fixes #23964Ryan T. Hosford2016-03-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Adds #each_chunk to ActionDispatch::Response. it's a method which will be called by ActionDispatch::Response#each. - Make Response#each a proper method instead of delegating to @stream - In Live, instead of overriding #each, override #each_chunk. - `#each` should just spit out @str_body if it's already set - Adds #test_set_header_after_read_body_during_action to prove this fixes #23964 - Adds #test_each_isnt_called_if_str_body_is_written to ensure #each_chunk is not called when @str_body is available - Call `@response.sent!` in AC::TestCase's #perform so a test response acts a bit more like a real response. Makes test that call `#assert_stream_closed` pass again. - Additionally assert `#committed?` in `#assert_stream_closed` - Make test that was calling @response.stream.each pass again by calling @response.each instead.
* | Pass over all Rails 5 warnings, to make sure:Vipul A M2016-04-121-1/+1
|/ | | | | | | | | | - we are ending sentences properly - fixing of space issues - fixed continuity issues in some sentences. Reverts https://github.com/rails/rails/commit/8fc97d198ef31c1d7a4b9b849b96fc08a667fb02 . This change reverts making sure we add '.' at end of deprecation sentences. This is to keep sentences within Rails itself consistent and with a '.' at the end.
* disable controller / view thread spawning in testsAaron Patterson2016-02-051-1/+8
| | | | | | | | | | | | | | | | | | Tests can (and do) access the database from the main thread. In this case they were starting a transaction, then making a request. The request would create a new thread, which would allocate a new database connection. Since the main thread started a transaction that contains data that the new thread wants to see, the new thread would not see it due to data visibility from transactions. Spawning the new thread in production is fine because middleware should not be doing database manipulation similar to the test harness. Before 603fe20c it was possible to set the database connection id based on a thread local, but 603fe20c changes the connection lookup code to never look at the "connection id" but only at the thread object itself. Without that indirection, we can't force threads to use the same connection pool as another thread. Fixes #23483
* Response etags to always be weak: Prefixed W/ to value returned by ↵abhishek2016-01-201-1/+1
| | | | ActionDispatch::Http::Cache::Response#etag= such that etags set in fresh_when and stale? are weak. For #17556.
* Fix `make_response!` when called by `serve` in `RouteSet`eileencodes2015-12-091-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | All of our tests were testing the `ActionController::Live` behavior in a standalone environment, without going through the router or behaving like a real application. This resulted in `ActionController::Live` throwing the exception `undefined method 'request' for #<ActionDispatch::Request:0x00000003ad1148>` because `make_response!` was expecting a response instead of a request. The expectation of a response came from `set_response!` in non-router tests setting the response and passing it to `make_response!`. In the case of an application we would hit `serve` in `RouteSet` first which would send us to `make_response!` with a request sent instead of a response. The changes here remove `set_response!` so `make_response!` always receives a request. Thanks to KalabiYau for help with the investigation and solution. Fixes #22524 [Eileen M. Uchitelle & KalabiYau]
* Require only necessary concurrent-ruby classes.Jerry D'Antonio2015-11-041-1/+1
|
* FIX: Randomly failing test when running without GIL.Guo Xiang Tan2015-10-231-0/+6
|
* call `get` instead of controller.processAaron Patterson2015-09-231-12/+10
| | | | | we want the request to go through the test harness, not directly call the methods on the controller
* remove controller constructionAaron Patterson2015-09-231-8/+4
| | | | also remove req / res references
* stop directly referencing the request and response objectsAaron Patterson2015-09-231-23/+21
|
* test framework allocates the controller for usAaron Patterson2015-09-231-1/+0
|
* type of response should not matterAaron Patterson2015-09-231-6/+0
|
* don't touch the response object until after we call `get`Aaron Patterson2015-09-231-5/+2
|
* Remove unused variablesakihiro172015-08-241-2/+2
|
* Stop using deprecated `render :text` in testPrem Sichanugrist2015-07-171-2/+2
| | | | | | | | | This will silence deprecation warnings. Most of the test can be changed from `render :text` to render `:plain` or `render :body` right away. However, there are some tests that needed to be fixed by hand as they actually assert the default Content-Type returned from `render :body`.
* Replaced `ActiveSupport::Concurrency::Latch` with concurrent-ruby.Jerry D'Antonio2015-07-131-14/+14
| | | | | | | | | | The concurrent-ruby gem is a toolset containing many concurrency utilities. Many of these utilities include runtime-specific optimizations when possible. Rather than clutter the Rails codebase with concurrency utilities separate from the core task, such tools can be superseded by similar tools in the more specialized gem. This commit replaces `ActiveSupport::Concurrency::Latch` with `Concurrent::CountDownLatch`, which is functionally equivalent.
* Skip the failing tests on Rubinius for nowRobin Dupret2015-03-021-0/+2
|
* When your templates change, browser caches bust automatically.Jeremy Kemper2014-08-171-1/+1
| | | | | | | | | | | | | | | | New default: the template digest is automatically included in your ETags. When you call `fresh_when @post`, the digest for `posts/show.html.erb` is mixed in so future changes to the HTML will blow HTTP caches for you. This makes it easy to HTTP-cache many more of your actions. If you render a different template, you can now pass the `:template` option to include its digest instead: fresh_when @post, template: 'widgets/show' Pass `template: false` to skip the lookup. To turn this off entirely, set: config.action_controller.etag_with_template_digest = false
* Handle client disconnect during live streamingMatthew Draper2014-06-081-0/+89
| | | | .. even when the producer is blocked for a write.
* Add multiple lines message support for SSE moduleayaya2014-05-121-0/+16
|
* re-raise error if error occurs before committing in streamingKevin Casey2014-03-141-0/+19
| | | | update the tests, using an if-else
* use the body proxy to freeze headersAaron Patterson2014-03-121-2/+4
| | | | | | 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
* only write the jar if the response isn't committedAaron Patterson2014-03-121-0/+13
| | | | | | | | | | | 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
* make sure we wait for the threads to shut down before asserting closureAaron Patterson2014-02-281-0/+1
|
* use built-in exception handling in live controllersAaron Patterson2014-02-281-15/+17
| | | | | | 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.
* live controllers should have live responsesAaron Patterson2014-02-281-13/+2
| | | | | | 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.
* set the error callback to a nice default in case nobody set an error ↵Aaron Patterson2014-02-281-0/+7
| | | | callback and an error happens
* Correct prestreaming controller response status.Kevin Casey2014-02-151-0/+18
| | | | | | 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)
* Merge pull request #11443 from wangjohn/sse_reloader_classSantiago Pastorino2013-08-191-0/+88
|\ | | | | SSE class for ActionController::Live
| * Creating an SSE class to be used with ActionController::Live.wangjohn2013-07-301-0/+88
| |
* | Add timeout to test_async_streamGaurish Sharma2013-08-021-1/+1
|/ | | | | | | | | | Without timeout: this test executed infinitely on JRuby Passes on MRI With Timeout: this test gracefully fails on JRuby Passes on MRI, tested on v2.0 & v1.9.3
* Exception handling for controllers using ActionController::LiveSean Griffin2013-03-181-1/+75
| | | | | | | | | Any exceptions that occured at the view or controller level for a controller using ActionController::Live would cause the server to either hang with an open socket indefinitely, or immediately crash (depending on whether the server was launched with rails s or directly). Changed the behavior of exceptions to act the same as streaming templates for html requests, and allow for an on_error callback if needed.
* Handle conditional get in live requests - this will prevent error when using ↵Bernard Potocki2013-03-141-0/+15
| | | | stale on live streams(issue #9636)
* Alias refute methods to assert_not and perfer assert_not on testsRafael Mendonça França2012-12-311-1/+1
|
* make sure the body finishes rendering before checking response closureAaron Patterson2012-08-031-1/+2
|