aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations/i18n_validation_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Revert "No such class since 8d2866bb80fbe81acb04f5b0c44f152f571fb29f"Rafael Mendonça França2019-08-021-1/+1
| | | | This reverts commit dd779c9686f49f5ed6dda8ad5a1cb3b0788e1dd4.
* No such class since 8d2866bb80fbe81acb04f5b0c44f152f571fb29fAkira Matsuda2019-08-021-1/+1
|
* Switch to use `class_attribute`:Edouard CHIN2019-07-161-0/+13
| | | | | | | | | - Since `ActiveModel::Error` can now be inherited by `ActiveModel::NestedError`, when the latter generates a `full_message`, the `i18n_customize_full_message` accessor set in the parent class is not set. This commit fixes that by using a `class_attribute` instead.
* Move the `ActiveModel:Errors#full_message` method to the `Error` class:Edouard CHIN2019-07-161-43/+43
| | | | | | | | | | | | | | | | - One regression introduced by the "AM errors as object" features is about the `full_messages` method. It's currently impossible to call that method if the `base` object passed in the constructor of `AM::Errors` doesn't respond to the `errors` method. That's because `full_messages` now makes a weird back and forth trip `AM::Errors#full_messages` -> `AM::Error#full_message` -> `AM::Errors#full_message` Since `full_message` (singular) isn't needed by AM::Errors, I moved it to the `AM::Error` (singular) class. This way we don't need to grab the `AM::Errors` object from the base.
* Merge pull request #32313 from lulalala/model_error_as_objectRafael França2019-04-241-2/+17
|\ | | | | Model error as object
| * Fix spec as generate_message is no longer called during validationlulalala2019-03-311-0/+15
| |
| * Fix misalignment caused by SHA eebb9ddf9ba559a510975c486fe59a4edc9da97dlulalala2019-03-311-2/+2
| |
* | Ensure acceptance validator is not applied more than once to PersonChris Salzberg2019-04-141-46/+52
|/
* Rename `i18n_full_message` config option to `i18n_customize_full_message`Prathamesh Sonpatki2019-03-291-13/+13
| | | | | | - I feel `i18n_customize_full_messages` explains the meaning of the config better. - Followup of https://github.com/rails/rails/pull/32956
* Call human_attribute_name with a string instead of a symboleMartin Larochelle2018-08-161-1/+1
|
* `ActiveModel.full_message` interaction with `index_errors`Martin Larochelle2018-08-141-0/+57
|
* Add global config for config.active_model.i18n_full_messageMartin Larochelle2018-06-051-0/+23
|
* Allow to override the full_message error formatMartin Larochelle2018-05-221-0/+36
|
* Use frozen string literal in activemodel/Kir Shatrov2017-07-161-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
|
* Fix broken comments indentation caused by rubocop auto-correct [ci skip]Ryuta Kamizono2016-09-141-1/+1
| | | | | | All indentation was normalized by rubocop auto-correct at 80e66cc4d90bf8c15d1a5f6e3152e90147f00772. But comments was still kept absolute position. This commit aligns comments with method definitions for consistency.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-5/+5
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* applies new string literal convention in activemodel/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.
* pass the correct argument to mock on a test of `validates_length_of`yuuji.yaginuma2015-07-281-1/+1
|
* Removes unnecessary comments from i18n validations tests [ci skip]Zamith2015-07-111-61/+2
| | | | | | These comments do not add a lot to the readability, grepability or overall understanding of the tests, therefore I believe they can be safely removed.
* Remove the reference to mocha in activemodelZamith2015-07-111-27/+27
| | | | | Activemodel is no longer dependent on mocha, so we can make the comments more generic.
* Use private method call assertions in Active Model tests.Kasper Timm Hansen2015-07-101-34/+31
| | | | Also fix Minitest constant reference.
* Fix typo in AM I18n validation test name [skip ci]Anton Davydov2015-06-091-1/+1
|
* Remove use of mocha from Active ModelRoque Pinel2015-05-281-32/+66
|
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-2/+0
| | | | onwards.
* Run ActiveModel test suites in random order.Zuhao Wan2014-03-101-0/+1
| | | | | | | | | | This gets the whole ActiveModel test suites working even if `self.i_suck_and_my_tests_are_order_dependent!` is disabled in `ActiveSupport::TestCase`. Two places are found that potentially leak global state. This patch makes sure states are restored so that none of the changes happen in a single test will be carried over to subsequence tests.
* Use the new clear_validators! api to reset validators in testsCarlos Antonio da Silva2014-01-271-2/+2
|
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-011-59/+58
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* use Array() instead flattenVasiliy Ermolovich2012-11-051-20/+0
| | | | | * move ActiveModel::Errors tests to errors_test.rb * add spec coverage for add_on_empty and add_on_blank
* Don't pass `:within` option to the i18nRafael Mendonça França2012-07-201-0/+22
|
* prevent users from unknowingly using bad regexps that can compromise ↵MrBrdo2012-06-141-2/+2
| | | | security (http://homakov.blogspot.co.uk/2012/05/saferweb-injects-in-various-ruby.html)
* Support i18n attributes for confirmationBrian Cardarella2012-04-241-1/+1
|
* confirmation validation error attributeBrian Cardarella2012-04-231-6/+11
| | | | | | | | | | | | This will render the error message on :#{attribute}_confirmation instead of on attribute itself. When rendering confirmation errors inline on the form with form builders such as SimpleForm and Formtastic it is confusing to the ender user to see the confirmation error message on the attribute element. Instead it makes more sense to have this validation error render on the confirmation field instead. The i18n message has been updated for the confirmation validator error message to include the original attribute name.
* Revert "Properly interpolate i18n keys in modules [#5572 state:resolved]"Santiago Pastorino2011-02-271-19/+0
| | | | | | | This breaks #6448, you should use :"module/class" as key for namespacing [#6448 state:committed] This reverts commit 8d30193b08bd2321a7a78a1f481bd5e4d4d45557.
* Properly interpolate i18n keys in modules [#5572 state:resolved]Rodrigo Rosenfeld Rosas2010-09-241-0/+19
|
* Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options ↵Jeroen van Dijk2010-06-211-338/+169
| | | | | | | | | | | | | | | | hash and make various Validators pass their (filtered) options. This makes it possible to pass additional options through Validators to message generation. E.g. plugin authors want to add validates_presence_of :foo, :format => "some format". Also, cleanup the :default vs :message options confusion in ActiveModel validation message generation. Also, deprecate ActiveModel::Errors#add_on_blank(attributes, custom_message) in favor of ActiveModel::Errors#add_on_blank(attributes, options). Also, refactoring of ActiveModel and ActiveRecord Validation tests. Test are a lot more DRY now. Better test coverage as well now. The first four points were reapplied from an older patch of Sven Fuchs which didn't apply cleanly anymore and was not complete yet. Signed-off-by: José Valim <jose.valim@gmail.com>
* removed AR from all AMo tests, including any unneeded files (schema, ↵Josh Kalderimis2010-05-091-3/+1
| | | | fixtures and test helper)
* Favor %{} in all code instead of (deprecated) {{}} as interpolation syntax ↵Lawrence Pit2010-05-031-1/+1
| | | | | | for I18n Signed-off-by: José Valim <jose.valim@gmail.com>
* Fix validates_numericaly_of only integer error message [#4406 state:resolved]reu2010-04-251-9/+9
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* errors.rb needs to be declared as UTF-8 [#3941 state:resolved]Aaron Patterson2010-04-021-0/+10
| | | | Signed-off-by: wycats <wycats@gmail.com>
* Drop AR I18n deprecation and simple use errors.messages as fallback.José Valim2010-01-301-14/+14
|
* Be sure to dup load paths before clearing the array.José Valim2010-01-071-1/+1
|
* Errors messages are now moved from :activerecord.errors to simply :errors on ↵José Valim2010-01-071-44/+44
| | | | I18n yml files.
* Remove deprecated ActiveModel tests (%d and %s is no longer supported in ↵José Valim2010-01-021-14/+0
| | | | error messages a couple months already)
* Use activerecord.errors.format as in Rails 2.3.5.José Valim2010-01-021-0/+6
|
* Be sure to convert namespaced names to we have 'Parrots name' instead of ↵José Valim2010-01-021-1/+1
| | | | 'Parrots.name' in error messages.
* No need to use ValidationsRepairHelper hack on ActiveModel anymore, ↵José Valim2009-12-231-1/+0
| | | | Model.reset_callbacks(:validate) is enough. However, tests in ActiveRecord are still coupled, so moved ValidationsRepairHelper back there.
* Move validator, human_name and human_attribute_name to ActiveModel, remove ↵José Valim2009-10-201-0/+8
| | | | | | deprecated error messages and add i18n_scope and lookup_ancestors. Signed-off-by: Carl Lerche <carllerche@mac.com>