aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/caching_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Use recyclable cache keys (#29092)David Heinemeier Hansson2017-05-181-24/+45
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-1/+1
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-3/+3
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Modify LogSubscriber for single partial's cache message.Stan Lo2016-08-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement naive partial caching mechanism. Add test for LogSubscriber Use ActionView::Base#log_payload to store log_subscriber's payload, so we can pass cache result into it. Fixed tests Remove useless settings Check if #log_payload exists before calling it. Because other classes also includes CacheHelper but don't have is attribute Use @log_payload_for_partial_reder instead of #log_payload to carry ActionView's payload. Update test's hash syntax Add configuration to enable/disable fragment caching logging Remove unless test and add new test to ensure cache info won't effect next rendering's log Move :enable_fragment_cache_logging config from ActionView to ActionPack Apply new config to tests Update actionview's changelog Update configuration guide Improve actionview's changelog Refactor PartialRenderer#render and log tests Mute subscriber's log instead of disabling instrumentation. Fix typo, remove useless comment and use new hash syntax Improve actionpack's log_subscriber test Fix rebase mistake Apply new config to all caching intstrument actions
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* modernizes hash syntax in actionpackXavier Noria2016-08-061-2/+2
|
* applies new string literal convention in actionpack/testXavier Noria2016-08-061-62/+62
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Bring back support for callable cache_key on collection renderingIgnatius Reza2016-07-211-1/+11
|
* Properly verify that cache accepts and user `expires` value.Vipul A M2016-04-171-1/+4
|
* Make collection caching explicit.Kasper Timm Hansen2016-02-201-16/+5
| | | | | | | | | | | | Having collection caching that wraps templates and automatically tries to infer if they are cachable proved to be too much of a hassle. We'd rather have it be something you explicitly turn on. This removes much of the code and docs to explain the previous automatic behavior. This change also removes scoped cache keys and passing cache_options.
* Only write to collection cache if we have a callable cache key.Kasper Timm Hansen2016-02-121-15/+8
| | | | | | | | | | | A callable cache key writes to the collection cache under a certain namespace. Which means if we don't have scoped cache key we can just rely on the `cache model_name do` in the templates to cache them. Less writes, more sharing. Add `assert_customer_cached` to better illustrate this in tests, and remove tests which then don't communicate as much.
* Check `partial_rendered_times` to clarify expectations.Kasper Timm Hansen2016-02-121-1/+4
| | | | | It was difficult to see when the partials were rendered, and how many times we expected it to be rendered before. Because we weren't explaining it.
* Test collection caching with callable cache key.Kasper Timm Hansen2016-02-121-0/+25
| | | | | | | When people pass `cache: -> item { item.upcase }` they scope the collection cache keys so the individual partial cache isn't reused. Test that behavior.
* restore ability to pass extra options to cache storesDave Gynn2015-12-261-0/+12
| | | | | | | | | The `cache` helper methods should pass any extra options to the cache store. For example :expires_in would be a valid option if memcache was the cache store. The change in commit da16745 broke the ability to pass any options other than :skip_digest and :virtual_path. This PR restores that functionality and adds a test for it.
* Add fragment_cache_key macro for controller-wide fragment cache key prefixesSam Stephenson2015-12-141-0/+25
|
* Remove mocha from ActionPack testsMarcin Olichwirowicz2015-09-051-14/+26
|
* pass the variant as a parameter to more reflect real world appsAaron Patterson2015-07-081-3/+3
|
* let the superclass build the request and responseAaron Patterson2015-07-081-6/+0
| | | | | We should leverage the request / response objects that the superclass has already allocated for us.
* Fix the random caching test failure.Kasper Timm Hansen2015-07-051-0/+1
|
* Fix flakyness.Kasper Timm Hansen2015-06-151-0/+1
| | | | Brought on by my own stupidity :)
* Replace expectation with state check.Kasper Timm Hansen2015-05-301-3/+7
| | | | The tests would still pass if the cache call in the rendered templates were removed.
* Collections automatically cache and fetch partials.Kasper Timm Hansen2015-02-211-0/+58
| | | | | | | | | | | | | | | | | | | | | | | Collections can take advantage of `multi_read` if they render one template and their partials begin with a cache call. The cache call must correspond to either what the collections elements are rendered as, or match the inferred name of the partial. So with a notifications/_notification.html.erb template like: ```ruby <% cache notification %> <%# ... %> <% end %> ``` A collection would be able to use `multi_read` if rendered like: ```ruby <%= render @notifications %> <%= render partial: 'notifications/notification', collection: @notifications, as: :notification %> ```
* Switch to kwargs in ActionController::TestCase and ActionDispatch::IntegrationKir Shatrov2015-01-291-4/+4
| | | | | | | | Non-kwargs requests are deprecated now. Guides are updated as well. `post url, nil, nil, { a: 'b' }` doesn't make sense. `post url, params: { y: x }, session: { a: 'b' }` would be an explicit way to do the same
* Add controller and action name to the instrumentation payloadDaniel Schierbeck2014-05-101-0/+16
|
* Update test helper to use latest Digestor APIDavid Heinemeier Hansson2014-03-211-8/+8
|
* Don't pass variant in params, it's ignoredŁukasz Strzałkowski2014-03-131-1/+1
| | | | We're setting variant above, in request object directly
* Ensure LookupContext in Digestor selects correct variantPiotr Chmolowski2014-03-091-0/+21
| | | | | | | | | | 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.
* Variants in ActionView::DigestorPiotr Chmolowski2014-03-041-2/+2
| | | | | | | | | | | 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
* Removed semicolon and added spaceAnupam Choudhury2013-09-131-2/+2
|
* Remove `page_cache_extension` deprecated methodFrancesco Rodriguez2013-07-011-15/+0
|
* Remove unneeded filesPiotr Sarnacki2013-06-201-1/+0
|
* evaluate the dependency blocks at the instance level, not class levelJamis Buck2013-01-081-2/+2
|
* view_cache_dependency APIJamis Buck2013-01-081-0/+18
| | | | | | | | | | | | | A declarative API for specifying dependencies that affect template cache digest computation. In your controller, specify any of said dependencies: view_cache_dependency { "phone" if using_phone? } When the block is evaluated, the resulting value is included in the cache digest calculation, allowing you to generate different digests for effectively the same template. (Mostly useful if you're mucking with template load paths.)
* Add explicit opt-out for fragment cache digestingDrew Ulmer2012-11-251-0/+12
| | | | | | | | | This add support for sending an explicit opt-out of the "Russian-doll" cache digest feature on a case-by-case basis. This is useful when cache- expiration needs to be performed manually and it would be otherwise difficult to know the exact name of a digested cache key. More information: https://github.com/rails/cache_digests/pull/16
* rename page_cache_extension option to default_static_extensionFrancesco Rodriguez2012-10-031-0/+15
|
* extract AP Page and Action caching to actionpack-deprecated_caching gemFrancesco Rodriguez2012-10-031-721/+16
|
* move metal/caching_test into controller/caching_testFrancesco Rodriguez2012-09-271-5/+42
|
* Add automatic template digests to all CacheHelper#cache calls (originally ↵David Heinemeier Hansson2012-08-291-5/+16
| | | | spiked in the cache_digests plugin) *DHH*
* set the controller under test so we no longer need the reset! methodAaron Patterson2012-08-091-38/+4
|
* Escape the extension when normalizing the action cache path.Andrew White2012-05-201-1/+30
| | | | | | | | | Although no recognized formats use non-ASCII characters, sometimes they can be included in the :format parameter because of invalid URLS. To prevent encoding incompatibility errors we need to escape them before passing the path to URI.unescape. Closes #4379
* added proc evaluation for action cache's layout parameterNico2012-05-021-1/+32
|
* Remove default match without specified methodJose and Yehuda2012-04-241-3/+3
| | | | | | | | | | | | | | | | In the current router DSL, using the +match+ DSL method will match all verbs for the path to the specified endpoint. In the vast majority of cases, people are currently using +match+ when they actually mean +get+. This introduces security implications. This commit disallows calling +match+ without an HTTP verb constraint by default. To explicitly match all verbs, this commit also adds a :via => :all option to +match+. Closes #5964
* Add config.default_method_for_update to support PATCHDavid Lee2012-02-221-1/+1
| | | | | | | | | | | | | | | | PATCH is the correct HTML verb to map to the #update action. The semantics for PATCH allows for partial updates, whereas PUT requires a complete replacement. Changes: * adds config.default_method_for_update you can set to :patch * optionally use PATCH instead of PUT in resource routes and forms * adds the #patch verb to routes to detect PATCH requests * adds #patch? to Request * changes documentation and comments to indicate support for PATCH This change maintains complete backwards compatibility by keeping :put as the default for config.default_method_for_update.
* Rack body respond to each and not to joinSantiago Pastorino2012-02-141-0/+12
| | | | | | | This fixes undef `to_str' for Rack::Chunked::Body when using caches_action + streaming on an action Closes #5027
* Remove rescue_action from compatibility module and testsCarlos Antonio da Silva2012-01-171-4/+0
|