aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/translation_helper_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* 🚨 Make the cops happy 🚨Aaron Patterson2019-02-061-1/+1
|
* Move templates to an anonymous subclass of AV::BaseAaron Patterson2019-02-061-1/+4
| | | | | Now we can throw away the subclass and the generated methods will get GC'd too
* Tighten up the AV::Base constructorAaron Patterson2019-01-291-1/+1
| | | | | | | | | | | | | | | The AV::Base constructor was too complicated, and this commit tightens up the parameters it will take. At runtime, AV::Base is most commonly constructed here: https://github.com/rails/rails/blob/94d54fa4ab641a0ddeb173409cb41cc5becc02a9/actionview/lib/action_view/rendering.rb#L72-L74 This provides an AV::Renderer instance, a hash of assignments, and a controller instance. Since this is the common case for construction, we should remove logic from the constructor that handles other cases. This commit introduces special constructors for those other cases. Interestingly, most code paths that construct AV::Base "strangely" are tests.
* Add safe html support to arrays of translationsJuan Broullon2018-07-031-2/+5
|
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-3/+3
|
* 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
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-33/+33
|
* applies new string literal convention in actionview/testXavier Noria2016-08-061-38/+38
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix typoAkshay Vishnoi2015-12-301-1/+1
|
* debug_missing_translation configuration added to action_viewSameer Rahmani2015-12-181-0/+10
| | | | | | | | | `I18n.translate` helper will wrap the missing translation keys in a <span> tag only if `debug_missing_translation` configuration has a truthy value. Default value is `true`. For example in `application.rb`: # in order to turn off missing key wrapping config.action_view.debug_missing_translation = false
* Ignore scope in missing translation input.Kasper Timm Hansen2015-10-281-0/+8
| | | | | | It's already represented in the key name. Demonstrate with a test. Also test that the default isn't output.
* Include interpolation values to translation_missing helperKir Shatrov2015-09-181-0/+6
|
* Removed Mocha from ActionView part 1Ronak Jangir2015-08-241-5/+8
|
* Remove :rescue_format option for translate helper since it's no longer ↵Bernard Potocki2015-05-041-14/+2
| | | | supported by I18n.
* Handle raise flag in translate when both main and default translation is ↵Bernard Potocki2015-05-041-0/+13
| | | | missing. Fixes #19967
* Allow an array to be a default translation value.Adam Prescott2015-04-041-0/+5
| | | | | | | | | | | 4.2.1 introduced a change to the way `translate`/`t` works with an option of `default: [[]]`. In 4.2.0, this would give a default value of `[]`, but in 4.2.1, it leads to a missing translation. `default: [[]]` is again allowed for cases where a default of `[]` is needed. This addresses GitHub issue 19640.
* Merge pull request #19421 from jcoyne/translate_defaults_with_nilRafael Mendonça França2015-03-201-0/+5
| | | | Strip nils out of default translations. Fixes #19419
* Fix regression when passing a value different of String.Ulisses Almeida2015-02-261-0/+5
| | | | | | | | | | | | | | | | | The previous version of rails(4.2.0) you can pass objects to the default option of translation helper. For example: ```ruby t('foo', default: 1) ``` But on rails 4.2.1 version this kind of use stopped to work, because started only to accept String types. Now with this fix we can use orther value types on this helper again.
* Avoid changing the global state on the testsRafael Mendonça França2015-01-051-1/+6
|
* Merge pull request #17676 from ↵Rafael Mendonça França2015-01-051-0/+19
|\ | | | | | | | | | | tigrish/fix_custom_i18n_exception_handler_regression Fix I18n regression introduced by #13832
| * Fix I18n regression introduced by #13832Christopher Dell2014-11-191-0/+19
| | | | | | | | Previously, when the `:raise` options was set to `false`, it would get overwritten to `true`, preventing custom exception handlers to be used.
* | Unsafe default translations should not be marked html_safeJustin Coyne2015-01-021-0/+6
|/ | | | | | Previously default translation keys that didn't end in `_html`, but came after a missing key that ended in `_html` were being returned as html_safe. Now they are not. Fixes #18257
* fix the undefined method content_tag #15245Rajarshi Das2014-09-061-1/+0
| | | | not required include ActionView::Helpers::TagHelper in test as well
* Clean up I18n stored translations after test.Zuhao Wan2014-06-141-1/+5
|
* Fix assertion order and :scissors: extra spacesCarlos Antonio da Silva2014-05-131-2/+2
|
* Dup options hash to prevent modificationsJosep Jaume Rey2014-05-131-0/+6
| | | | `options[:default]` and `options[:raise]` can be mistakenly added to the `options` hash. This can be a problem if you're reusing the same object.
* Rails config for raise on missing translationsKassio Borges2014-01-271-0/+10
| | | | | Add a config to setup whether raise exception for missing translation or not.
* Escalate missing error when :raise is trueShota Fukumori (sora_h)2013-12-051-0/+6
| | | | | | | | | | | | | | Before ec16ba75a5493b9da972eea08bae630eba35b62f, ActionView::Helpers::TranslationHelper#translate has raised errors with specifying options[:raise] to true. This should work by this fix: begin t(:"translations.missing", raise: true) rescue I18n::MissingTranslationData p :hello! end
* Stop using i18n's built in HTML error handling.Michael Koziarski2013-12-021-1/+1
| | | | | | | | | i18n doesn't depend on active support which means it can't use our html_safe code to do its escaping when generating the spans. Rather than try to sanitize the output from i18n, just revert to our old behaviour of rescuing the error and constructing the tag ourselves. Fixes: CVE-2013-4491
* Move template tests from actionpack to actionviewPiotr Sarnacki2013-06-201-0/+138