aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/render_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | Make ActionView frozen string literal friendly.Pat Allan2017-06-201-2/+2
|/ | | | Plus a couple of related ActionPack patches.
* Define path with __dir__bogdanvlviv2017-05-231-2/+2
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Use recyclable cache keys (#29092)David Heinemeier Hansson2017-05-181-3/+3
|
* Should escape meta characters in regexpRyuta Kamizono2017-05-071-2/+2
|
* Add tests for render template/partial with variants option.Stan Lo2017-04-141-0/+8
|
* Add information on `:formats` option in action_view_overview.mdkenta-s2017-02-061-2/+1
|
* Fix CI failure caused by aa647b46cce55ec12f5895e403c0d1b85502c8e0Ryuta Kamizono2017-02-021-1/+1
|
* Fix test failures only seen when executed via bin/testAkira Matsuda2017-02-021-1/+1
| | | | | sub_template_message distracts Rails.root from its message only when Rails.root is defined, and Rails.root is defined at tools/test.rb
* Merge pull request #27795 from meagar/fix-missing-partial-iterationRafael França2017-01-311-0/+9
|\ | | | | Fix missing partial iteration
| * Add partial iteration variable to template keysMatthew Eagar2017-01-251-0/+9
| | | | | | | | | | | | | | When rendering heterogeneous collection using `render @collection` or `render partial: @collection`, the expected `<partial_name>_iteration` variable is missing due to `find_template` not having the name of the iteration variable included in its cache keys.
* | Get neglected TODO done in render_testkenta-s2017-01-241-2/+1
|/
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-5/+5
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* Remove unneeded Deprecation silenceRafael Mendonça França2017-01-061-5/+3
|
* improve error message when include assertions failMichael Grosser2016-09-161-1/+1
| | | | | | assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
* Add three new rubocop rulesRafael Mendonça França2016-08-161-7/+7
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* modernizes hash syntax in actionviewXavier Noria2016-08-061-99/+99
|
* applies new string literal convention in actionview/testXavier Noria2016-08-061-41/+41
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Use Ruby >= 1.9 hash syntax as is the preferenceSteven Harman2016-07-261-1/+1
|
* Fix collection_from_options to allow EnumeratorsSteven Harman2016-07-261-0/+8
| | | | | | | | | | | | | An optimization was introduced in https://github.com/rails/rails/commit/27f4ffd11a91b534fde9b484cb7c4e515ec0fe77 which tried to `#to_ary` the collection to prevent unnecessary queries for ActiveRecord scopes/relations. If the given collection did not respond to `#to_ary`, and empty collection was returned. That meant you couldn't use collections built from `Enumerator` nor `Enumerable`. With this change, `#collection_from_options` will attempt the optimization, but fall back to passing along the given collection, as-is.
* Change the raw template handler to render html-safe stringseileencodes2016-06-211-0/+7
| | | | | | | | | | | | | | | In PR #24929 the changelog was updated to make note that while the new template handler was changed to raw this changed the behavior when outputting plain html or js files. Previously ERB would output the files unescaped. Changing the default handler to RAW meant that these same files would be rendered as escaped rather than as js or html. Because of this change in behavior and after the discussion #24949 in we decided to change the behavior of the Raw handler to output html_safe strings by default. Now files rendered with the default handler (raw) render the file unescaped.
* Add render allows unicode text name in partials - 🍣Vipul A M2016-04-171-0/+4
|
* Fix partial rendering with dot in filenameBenjamin Quorning2016-03-041-0/+5
| | | | | | | | When rendering a collection with a partial whose filename contains a dot, e.g. "customer.mobile", we would set a `locals[:'customer.mobile']` variable instead of, as in earlier versions of Rails, `locals[:customer]`. This bug was introduced in da9038eaa5d19c77c734a044c6b35d7bfac01104.
* Make collection caching explicit.Kasper Timm Hansen2016-02-201-26/+29
| | | | | | | | | | | | 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.
* WIP: Errors in logs should show log tags as well.Vipul A M2016-02-121-3/+3
| | | | | | | - Changed formatted_code_for to return array of logs to be tagged for each line - Changed some render tests to match new behaviour of return Fixes #22979
* Merge branch '5-0-beta-sec'Aaron Patterson2016-01-251-0/+7
|\ | | | | | | | | | | | | | | | | | | | | * 5-0-beta-sec: bumping version fix version update task to deal with .beta1.1 Eliminate instance level writers for class accessors allow :file to be outside rails root, but anything else must be inside the rails view directory Don't short-circuit reject_if proc stop caching mime types globally use secure string comparisons for basic auth username / password
| * allow :file to be outside rails root, but anything else must be inside the ↵Aaron Patterson2016-01-221-0/+7
| | | | | | | | | | | | rails view directory CVE-2016-0752
* | Add Html template handler that wraps Raw output in an OutputBufferSantiago Pastorino2016-01-051-1/+6
|/ | | | | | | This fixes the case when you try to render an html you know safe and the file is named something.html. With this commit the content of the html won't be escaped anymore because AV won't use Raw handler and choose Html handler instead.
* Remove ActionView::Helpers::CacheHelper#fragment_cache_keySam Stephenson2015-12-141-0/+4
| | | | | | Introduced in e56c63542780fe2fb804636a875f95cae08ab3f4, `CacheHelper#fragment_cache_key` is a duplicate of `ActionController::Caching::Fragments#fragment_cache_key`. We now require the view to provide this method on its own (as with `view_cache_dependencies`); `ActionController::Caching::Fragments` exports its version as a `helper_method`.
* Respect value of `:object` if `:object` is false when renderingyui-knk2015-11-131-0/+2
| | | | | This commit fixes the bug convering `false` to `locals[as]` when `options[:object]` is `false` (close #22260).
* Deprecate exception#original_exception in favor of exception#causeYuki Nishijima2015-11-031-4/+4
|
* Added test cases where collection partial cached for different key and ↵Ronak Jangir2015-09-261-0/+10
| | | | rendered for different key
* Fix cache issue when different partials use the same collectionRoque Pinel2015-06-281-4/+13
| | | | | | | | | Adds the `virtual_path` option to `cache_fragment_name` so it can be provided when needed. That allows `cache_collection_render` to get the appropriate cache key with the digest generated based on the template and prevent collision with other templates that cache the same collection.
* Do not put partial name to local_assigns when rendering without an objectHenrik Nygren2015-05-141-0/+8
| | | | | | | | When one rendered a partial template without specifying an object or a collection (e.g. <%= render partial: 'partial_name' %>), Rails would make an object called :partial_name available in local_assigns. I don't think this was the intended behavior, since no local variable called 'partial_name' gets defined in the view.
* Merge pull request #18948 from kaspth/automatic-collection-cachingRafael Mendonça França2015-02-251-0/+38
|\ | | | | Merge multi_fetch_fragments.
| * Collections automatically cache and fetch partials.Kasper Timm Hansen2015-02-211-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 %> ```
| * Merge multi_fetch_fragments.Kasper Timm Hansen2015-02-201-0/+14
| | | | | | | | | | | | | | | | Makes caching a collection of template partials faster using `read_multi` on the Rails cache store. Some caching implementations have optimized `read_multi` so we don't have to check in the cache store for every template.
* | Error message testing fixFranky W2015-02-201-1/+2
|/ | | | | | | | | The testing of error messages have been implemented wrongly a few times. This is an attempt to fix it. For example, some of these test should have failed with the new code. The reason they are not failling with the new string is the fact they were not being tested beforehand.
* Partial template name does no more have to be a valid Ruby identifierAkira Matsuda2015-02-061-13/+8
| | | | because the partial renderer would not create an lvar per each template since c67005f221f102fe2caca231027d9b11cf630484
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Merge pull request #17974 from killthekitten/fix-render-blockRafael Mendonça França2015-01-021-0/+5
|\ | | | | | | | | | | | | Make possible to use blocks with short version of render partial Conflicts: actionview/CHANGELOG.md
| * Make possible to use blocks with short version of render partialNikolay Shebanov2014-12-191-0/+5
| |
* | fix error message of option as with invalid charters in partial renderingAngelo capilleri2014-12-291-3/+17
|/ | | | | before this PR IDENTIFIER_ERROR_MESSAGE could lead to misunderstand the convention of partial name. Added OPTION_AS_ERROR_MESSAGE for unvalid charter in as option.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* adding missing test coverageEugene Gilburg2014-07-181-0/+12
|
* Added PartialIteration class used when rendering collectionsJoel Junström2014-07-161-1/+1
| | | | | | | | | | | | The iteration object is available as the local variable "template_name_iteration" when rendering partials with collections. It gives access to the +size+ of the collection beeing iterated over, the current +index+ and two convinicence methods +first?+ and +last?+ "template_name_counter" variable is kept but is deprecated. [Joel Junström + Lucas Uyezu]
* Assert the nature of the original exceptionMatthew Draper2014-07-121-0/+1
| | | | | | Just so it's clearer what's going on in the following assertion. /cc #11993 @robin850