aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/digestor_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Make Template::Resolver always cacheJohn Hawthorn2019-03-151-0/+2
| | | | | | | | | | | | All actionview caches are already cleared at the start of each request (when Resolver.caching is false) by PerExecutionDigestCacheExpiry, which calls LookupContext::DetailsKey.clear (which clears all caches). Because caches are always cleared per-request in dev, we shouldn't need this extra logic to compare mtimes and conditionally reload templates. This should make templates slightly faster in development (particularly multiple renders of the same template)
* Templates have one formatAaron Patterson2019-02-251-1/+1
| | | | | | | Templates only have one format. Before this commit, templates would be constructed with a single element array that contained the format. This commit eliminates the single element array and just implements a `format` method. This saves one array allocation per template.
* Pass the template format to the digestorAaron Patterson2019-02-151-12/+13
| | | | | | | | | | | | | | | This commit passes the template format to the digestor in order to come up with a key. Before this commit, the digestor would depend on the side effect of the template renderer setting the rendered_format on the lookup context. I would like to remove that mutation, so I've changed this to pass the template format in to the digestor. I've introduced a new instance variable that will be alive during a template render. When the template is being rendered, it pushes the current template on to a stack, setting `@current_template` to the template currently being rendered. When the cache helper asks the digestor for a key, it uses the format of the template currently on the stack.
* Fix digesting templates with mixed formatsJavan Makhmali2018-03-201-0/+12
|
* Remove unused `FixtureTemplate` classyuuji.yaginuma2017-10-191-11/+0
| | | | `FixtureTemplate` is no longer used since 3d7892d.
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-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
* Fix `assert_logged` failureRyuta Kamizono2017-03-231-2/+2
| | | | | `'#{name}' file doesn't exist, so no dependencies` was removed in bb04814.
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-3/+3
|
* 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.
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-1/+1
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in actionview/testXavier Noria2016-08-061-7/+7
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Add test for nested html dependencies with same logical name as templates ↵Javan Makhmali2016-06-151-2/+6
| | | | for other formats
* Move and rename testJavan Makhmali2016-06-151-7/+7
|
* Fix finding templates for digesting for */* requests that render a ↵Javan Makhmali2016-06-151-0/+22
| | | | non-default (html) template
* Explicity find with the rendered format to handle searching multiple view ↵Javan Makhmali2016-06-151-1/+1
| | | | paths correctly
* Fix digesting templates with identical logical names when requesting a ↵Javan Makhmali2016-06-151-1/+11
| | | | format other than the first default
* Extract resolver cache disabling to a method.Kasper Timm Hansen2016-05-091-22/+23
| | | | Will be using this in later code.
* No need to call `remove_template`.Kasper Timm Hansen2016-05-091-1/+0
| | | | | Each test executes in another tmp folder, so there's no chance of polluting another test run.
* Merge branch 'master' into treewipAaron Patterson2016-02-241-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (113 commits) remove useless method Updated file documentation [ci skip] changes caching guide to add note on weak etags Don't put config.action_mailer.perform_caching entry twice in development.rb Fix wording and wrong reference Add Ruby formatting to CHANGELOG entry Fix ActionView's cache section reference Do not define methods in the included block Add caching guide in ActionMailer basics Add ActionMailer configuration options Preparing for 5.0.0.beta3 release Update 5.0 release notes Enable tmp_restart plugin for puma Prep release for Rails 5 beta3 [ci skip] Move collection caching changelog entry. Ensure `drop_table` even if tests failure or interrupted :bomb: run the test @rafaelfranca :angry: Remove changelog entry for reverted commit Add CHANGELOG for https://github.com/rails/rails/pull/23734 [ci skip] No need CHANGELOG entry for #23849. ...
| * clear digest cache between testsAaron Patterson2016-02-231-0/+1
| | | | | | | | | | otherwise we don't get the log messages we're looking for and the tests fail intermittently.
* | push injected dependencies up to the `digest` methodAaron Patterson2016-02-181-2/+2
| | | | | | | | | | | | Only the root node has injected dependencies, so we don't need to care about them at lower levels. This change pushes the injected dependencies up to where the user passed them in.
* | use the class level digest method for calculating the digestAaron Patterson2016-02-181-3/+1
| |
* | cache all subnodes in the digest cacheAaron Patterson2016-02-181-1/+1
| | | | | | | | | | | | | | | | | | this is for backwards compatibility. We should remove this after 5-0-stable is created because digest calculation should be amortized. Caching digests of subtrees will speed up digests for other trees that share the same children. However, this will also increase memory, and after the app warms up, then those subtrees will never be reused which means that memory is wasted.
* | Merge branch 'master' into treewipAaron Patterson2016-02-181-3/+12
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * master: (27 commits) move digest cache on to the DetailsKey object remove object `hash` cache [ci skip] fix suggested change-replace 'an' with 'the in Rails engine guide' Missing documentation about hash algorithm option for MessageVerifier [ci skip] set `skip_listen` option to dummy appplication Fix the language in engines guide Add accidentally removed `#` [ci skip] fields_for_style needs to test for AC::Parameters Fix indentation for code block in changelog Remove accidentally duplicated change log title [ci skip] partially revert 69009f4473637a44ade26d954ef5ddea6ff903f2 Remove needless `case_insensitive_comparison` in mysql2 adapter modify to `error` also abort when specify fail fast option Implement ActionController::Parameters#inspect remove unused method Remove unused Journey code Add Action Cable CHANGELOG in release notes [ci skip] Show proper error message when a non-relation object is passed to AR::Relation#or Fix semantics of test names for finish option in batches_test Fix typo ... Conflicts: actionview/lib/action_view/digestor.rb
| * move digest cache on to the DetailsKey objectAaron Patterson2016-02-181-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This moves digest calculation cache on to the details key object. Before, the digest cache was a class level ivar, and one of the keys was the hash value of the details key object: https://github.com/rails/rails/blob/13c4cc3b5aea02716b7459c0da641438077f5236/actionview/lib/action_view/digestor.rb#L28 An object's hash value is not unique, so it's possible for this cache key to produce colliding keys with no resolution. This commit move cache on to the details key object itself, so we know that the digests are always unique per details key object.
| * adds tests for Digestor#nested_dependenciesRyan T. Hosford2016-02-131-0/+10
| |
* | change internal implementation to use a treeAaron Patterson2016-02-161-13/+10
| |
* | fix recursive templatesAaron Patterson2016-02-161-2/+3
| |
* | pull template check up to match existing behaviorAaron Patterson2016-02-161-1/+4
| | | | | | | | also remove the EMPTY node since we won't need it
* | introduce a `tree` factory method for creating the dep treeAaron Patterson2016-02-161-0/+7
|/ | | | also add an EMPTY sentinel node
* push kwargs up to the user facing APIAaron Patterson2016-02-121-2/+2
| | | | | | | this lets us leverage Ruby's kwarg handling (exceptions for missing params, etc) ASAP which allows us to skip active support method calls and make sure the exception stack is closer to where the user called the methods.
* the lookup context looks in the cwd, so prefix isn't necessaryAaron Patterson2016-02-121-2/+1
|
* use a real LookupContext in the digest testsAaron Patterson2016-02-121-28/+6
| | | | | This will ensure that the digestor stays in parity with the LookupContext object.
* use assert_not_equal so there will be better error messagesAaron Patterson2016-02-121-1/+1
| | | | in the case of failure it is nice to see what the two digests are.
* Add wildcard template dependencies.Kasper Timm Hansen2015-07-261-1/+36
|
* Remove unused persistent option.Kasper Timm Hansen2015-07-181-3/+3
|
* Make digest cache work in development.Kasper Timm Hansen2015-07-181-10/+0
| | | | | | Avoid computing the same fragment digest many times when looping over templates. The cache is cleared on every request so template changes are still picked up.
* add error log that notify 'file not found' when using ↵Faruk AYDIN2015-05-071-0/+20
| | | | cache_digests:dependency and cache_digests:nested_dependency tasks
* Make sure restoration always happen.Zuhao Wan2014-06-141-0/+1
|
* Digestor should just rely on the finder to know about the format and the ↵David Heinemeier Hansson2014-03-211-10/+7
| | | | variant -- trying to pass it back in makes a mess of things (oh, and doesnt work)
* Clarify AV::Digestor.digest method signature docs and deprecation warningJeremy Kemper2014-03-151-2/+2
|
* Fix the resolver cache and stop mutating the lookup_contextRafael Mendonça França2014-03-141-8/+0
| | | | | Before we had a bug in the resolver cache so the disable_cache were not working when passing options to find
* Introduce #with_formats_and_variants to prevent problems with mutating ↵Łukasz Strzałkowski2014-03-141-0/+8
| | | | finder object
* Add mocked disable_cache for FixtureFinderŁukasz Strzałkowski2014-03-141-0/+4
|
* Set format in finderŁukasz Strzałkowski2014-03-141-3/+8
|
* Ensure LookupContext in Digestor selects correct variantPiotr Chmolowski2014-03-091-3/+5
| | | | | | | | | | 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.