aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/models
Commit message (Collapse)AuthorAgeFilesLines
* Fix numericality validator to still use value before type cast except Active ↵Ryuta Kamizono2018-08-241-0/+14
| | | | | | | | | | | | | | | | | | | Record The purpose of fe9547b is to work type casting to value from database. But that was caused not to use the value before type cast even except Active Record. There we never guarantees that the value before type cast was going to the used in this validation, but we should not change the behavior unless there is some particular reason. To restore original behavior, still use the value before type cast if `came_from_user?` is undefined (i.e. except Active Record). Fixes #33651. Fixes #33686.
* has_secure_password: use `recovery_password` instead of `activation_token`bogdanvlviv2018-07-081-2/+2
| | | | | | Since we have `has_secure_token`, it is too confusing to use `_token` suffix with `has_secure_password`. Context https://github.com/rails/rails/pull/33307#discussion_r200807185
* Fix Ruby warnings tickled by the test suiteutilum2018-06-301-1/+2
|
* Merge pull request #26764 from choncou/improve_has_secure_passwordRafael Mendonça França2018-06-281-1/+2
|\ | | | | | | Allow configurable attribute name on `#has_secure_password`
| * This addition will now allow configuring an attribute name for theUnathi Chonco2016-10-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | existing `#has_secure_password`. This can be useful when one would like to store some secure field as a digest, just like a password. The method still defaults to `password`. It now also allows using the same `#authenticate` method which now accepts a second argument for specifying the attribute to be authenticated, or will default to 'password`. A new method is also added for generating a new token for an attribute by calling `#regenerate_XXXX` where `XXXX` is the attribute name.
* | Add cases to test combining validation conditionsbogdanvlviv2017-11-062-1/+5
| | | | | | | | | | | | | | | | | | - Test condition that is defined by array of conditions - Test condition that is defined by combining :if and :unless - Test local condition that is defined by :if - Test local condition that is defined by :unless See http://edgeguides.rubyonrails.org/active_record_validations.html#combining-validation-conditions
* | Use frozen string literal in activemodel/Kir Shatrov2017-07-1613-0/+26
| |
* | Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-0213-13/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* | Enforce frozen string in RubocopKir Shatrov2017-07-0113-0/+13
|/
* Removed deprecated :tokenizer in the length validatorRafael Mendonça França2016-10-101-4/+0
|
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-064-4/+4
|
* applies new string literal convention in activemodel/testXavier Noria2016-08-061-1/+1
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Remove unused require and unused model stubJon Moss2016-05-311-3/+0
| | | | | | | | | - The `Project` model should have been removed in 468939297db91f8e595a93c94a16e23b26eee61a. - The superfluous require was added in 605c6455ac722ed9679e17458a47cc649cdedab0. Closes #25215 Signed-off-by: Jeremy Daer <jeremydaer@gmail.com>
* Remove XML Serialization from core.Zachary Scott2015-08-071-1/+0
| | | | | | | This includes the following classes: - ActiveModel::Serializers::Xml - ActiveRecord::Serialization::XmlSerializer
* Merge pull request #16381 from kakipo/validate-length-tokenizerRafael Mendonça França2015-02-131-0/+4
|\ | | | | | | Allow symbol as values for `tokenizer` of `LengthValidator`
| * Allow symbol as values for `tokenize` of `LengthValidator`kakipo2014-08-031-0/+4
| |
* | Move model definition to test/models for test order indenendencyAkira Matsuda2014-08-281-0/+15
|/
* Merge pull request #15959 from aditya-kapoor/remove-unneeded-casesRafael Mendonça França2014-07-291-13/+0
|\ | | | | remove unneeded test model for ActiveModel test cases.
| * remove unneeded test model for ActiveModel test cases.Aditya Kapoor2014-06-281-13/+0
| |
* | automatically include ActiveModel::Validations when include ↵Aditya Kapoor2014-07-032-2/+0
|/ | | | ActiveModel::SecurePassword
* Fix some validators when used on model instanceEric Hutzelman2014-02-261-1/+2
| | | | | | | | Now that Validator #setup is called from the initializer, we need a reference to the model's class to be passed in to allow the validators to continue functioning when used at the instance level. Closes #14134.
* Removed old testsGodfrey Chan2014-01-241-11/+0
|
* Rewrote the tests for has_secure_passwordGodfrey Chan2014-01-242-2/+2
|
* Unused classes in AMo testsAkira Matsuda2013-12-191-11/+0
|
* Let validates_inclusion_of accept Time and DateTime rangesAkira Matsuda2013-10-231-1/+1
| | | | fixes 4.0.0 regression introduced in 0317b93c17a46d7663a8c36edc26ad0ba3d75f85
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-013-6/+6
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* test for ActiveModel::Conversion#to_partial_path and namespaced modelsYves Senn2013-01-141-0/+4
|
* Remove observers and sweepersRafael Mendonça França2012-11-281-27/+0
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* fix failing isolated testsFrancesco Rodriguez2012-10-261-0/+1
|
* AM::Serializers::Xml depends on AM::NamingFrancesco Rodriguez2012-10-261-1/+0
|
* attr_accessible and attr_protected raise an exception pointing to use plugin ↵Guillermo Iguaran2012-09-161-0/+3
| | | | or new protection model
* Remove MassAssignmentSecurity from ActiveModelGuillermo Iguaran2012-09-164-88/+7
| | | | This will be moved out to protected_attributes gem
* Integrate ActiveModel::ForbiddenAttributesProtection from StrongParameters gemGuillermo Iguaran2012-09-161-0/+7
|
* has_secure_password should not raise a 'digest missing' error if the calling ↵Robby Grossman2012-07-311-0/+11
| | | | class has specified for validations to be skipped.
* Updated tests for has_secure_password.Erich Menge2012-05-083-2/+11
|
* Rely on a public contract between railties instead of accessing railtie ↵José Valim2011-11-231-6/+2
| | | | methods directly.
* Let ActiveModel instances define partial paths.Grant Hutchins & Peter Jaros2011-07-251-0/+3
| | | | | | Deprecate ActiveModel::Name#partial_path. Now you should call #to_path directly on ActiveModel instances.
* Allow to specify mass-assignment roles as arrayAlexander Uvarov2011-06-231-1/+9
|
* Methods that return nil should not be considered YAMLJoshua Wehner2011-05-101-0/+4
|
* Allow observers to be enabled and disabled.Myron Marston2011-04-281-0/+27
| | | | This is useful in situations like model unit tests and the occasional rake task to backfill old data.
* AM mass assignment security attr_accessible and attr_protected now allow for ↵Josh Kalderimis2011-04-241-0/+11
| | | | | | | | scopes using :as => scope eg. attr_accessible :name attr_accessible :name, :admin, :as => :admin
* Revert "Properly interpolate i18n keys in modules [#5572 state:resolved]"Santiago Pastorino2011-02-271-5/+0
| | | | | | | This breaks #6448, you should use :"module/class" as key for namespacing [#6448 state:committed] This reverts commit 8d30193b08bd2321a7a78a1f481bd5e4d4d45557.
* failing test for i18n key collision with namespaced modelsSantiago Pastorino2011-02-271-0/+4
|
* Override attributes_protected_by_default when has_secure_password is called.Tsutomu Kuroda2011-02-092-0/+19
| | | | | | | attr_protected should not be called, because it nullifies the mass assignment protection that has been set by attr_accessible. Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Optionally pass in the attribute being validated to an instance method validatorCarl Lerche2011-02-051-0/+4
|
* Be able to pass a validator method to #validatesCarl Lerche2011-02-051-0/+4
|
* Provide a way to specify alternate option keys for validatesCarl Lerche2011-02-051-0/+4
|
* Added ActiveRecord::Base#has_secure_password (via ↵David Heinemeier Hansson2010-12-181-0/+8
| | | | ActiveModel::SecurePassword) to encapsulate dead-simple password usage with SHA2 encryption and salting
* No need to pass self as parameter here.José Valim2010-10-041-1/+1
|