aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations
Commit message (Collapse)AuthorAgeFilesLines
* Add support for namespaced validatorsSamuel Kadolph2010-12-161-0/+8
| | | | | | Includes test and documentation for new feature Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Properly interpolate i18n keys in modules [#5572 state:resolved]Rodrigo Rosenfeld Rosas2010-09-241-0/+19
|
* Better shortcut options for custom validators [#5672 state:resolved]Obie Fernandez2010-09-241-0/+9
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-4/+4
| | | | 's/[ \t]*$//' -i {} \;)
* Failing test for validates_length_of, when both too_short and too_long ↵rohit2010-08-031-0/+14
| | | | | | messages are set [#5283 state:open] Signed-off-by: José Valim <jose.valim@gmail.com>
* Missing BigDecimal dependencyJeremy Kemper2010-06-271-0/+2
|
* Work around the fact the JSON gem was overwriting to_json implementation for ↵José Valim2010-06-261-1/+1
| | | | | | | all Ruby core classes. This is required because the JSON gem is incompatible with Rails behavior and was not allowing ActiveModel::Errors to be serialized. So we need to ensure Rails implementation is the one triggered. [#4890 state:resolved]
* Avoid method redefined warningSantiago Pastorino2010-06-221-1/+2
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options ↵Jeroen van Dijk2010-06-212-379/+210
| | | | | | | | | | | | | | | | 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>
* ActiveModel::Validations::Callbacks should not be required by default.José Valim2010-06-191-0/+1
|
* moving before_validation and after_validation functionality from ↵Neeraj Singh2010-06-191-0/+76
| | | | | | | | ActiveRecord to ActiveModel [#4653 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Add a valid hex that shouldn't be valid to ActiveModel numericality tests ↵rohit2010-05-181-1/+1
| | | | | | [#4622 state:commited] Signed-off-by: José Valim <jose.valim@gmail.com>
* Valid hex strings aren't valid float column values, to match the integer ↵Jeremy Kemper2010-05-171-1/+1
| | | | restriction. [#4622 state:resolved]
* Make use of assert_equal to test equallity between object assert expects and ↵Santiago Pastorino2010-05-161-2/+2
| | | | | | | | object and a message of error [#4611 state:committed] Signed-off-by: José Valim <jose.valim@gmail.com>
* Revert "Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an ↵José Valim2010-05-152-73/+73
| | | | | | | | options hash and make various Validators pass their (filtered) options." Having a huge array to whitelist options is not the proper way to handle this case. This means that the ActiveModel::Errors object should know about the options given in *all* validators and break the extensibility added by the validators itself. If the intent is to whitelist options before sending them to I18n, each validator should clean its respective options instead of throwing the responsibility to the Errors object. This reverts commit bc1c8d58ec45593acba614d1d0fecb49adef08ff.
* Make ActiveModel::Errors#add_on_blank and #add_on_empty accept an options ↵Jeroen van Dijk2010-05-152-73/+73
| | | | | | | | | | | | | | | | | | | | 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). Original patch by Sven Fuchs, some minor changes and has been changed to be applicable to master again [#4057 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* removed AR from all AMo tests, including any unneeded files (schema, ↵Josh Kalderimis2010-05-0913-27/+2
| | | | fixtures and test helper)
* removed an old unused model in the AMo tests which also removes another AR ↵Josh Kalderimis2010-05-097-7/+0
| | | | dependency
* removed use of AR in AMo tests and removed testing of scopes (:on) in ↵Josh Kalderimis2010-05-0811-247/+188
| | | | individual validation tests and moved them to their own test file
* Favor %{} in all code instead of (deprecated) {{}} as interpolation syntax ↵Lawrence Pit2010-05-038-37/+37
| | | | | | 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>
* Accept array of attributes as arg also, like 2.3Jeremy Kemper2010-02-251-10/+16
|
* Add validators reflection so you can do 'Person.validators' and ↵Prem Sichanugrist2010-02-211-0/+1
| | | | | | 'Person.validators_on(:name)'. Signed-off-by: José Valim <jose.valim@gmail.com>
* Drop AR I18n deprecation and simple use errors.messages as fallback.José Valim2010-01-301-14/+14
|
* Fix typos and add tests to ensure they will be caught the next time.José Valim2010-01-111-0/+8
|
* Fix typo by renaming :genre to :gender.José Valim2010-01-091-6/+6
|
* Allow validates to map some types to specific options. So now you can do:José Valim2010-01-081-11/+37
| | | | | | validates :email, :presence => true, :format => /@/ validates :genre, :inclusion => %w(m f) validates :password, :length => 6..20
* Compile length validator options still at the class level, so whenever the ↵José Valim2010-01-081-4/+2
| | | | validator is called, it just needs to check for :maximum, :minimum and :is values.
* Allow :if, :unless, :on, :allow_nil and :allow_blank as shared options in ↵José Valim2010-01-071-3/+38
| | | | validates.
* Add validates method as shortcut to setup validators for a given set of ↵jamie2010-01-072-0/+75
| | | | | | | | | | | | | | | attributes: class Person < ActiveRecord::Base include MyValidators validates :name, :presence => true, :uniqueness => true, :length => { :maximum => 100 } validates :email, :presence => true, :email => true end [#3058 status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* 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-072-80/+44
| | | | I18n yml files.
* Add missing tests to Validators.José Valim2010-01-031-0/+47
|
* 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-2311-199/+116
| | | | Model.reset_callbacks(:validate) is enough. However, tests in ActiveRecord are still coupled, so moved ValidationsRepairHelper back there.
* Move validations in ActiveModel to validators, however all validatity checks ↵José Valim2009-12-231-2/+2
| | | | are still in the class method.
* Validator is simply sent to validate method. However, the API needs to ↵José Valim2009-12-221-6/+6
| | | | change, so validate accepts a record.
* Move validator, human_name and human_attribute_name to ActiveModel, remove ↵José Valim2009-10-203-5/+12
| | | | | | deprecated error messages and add i18n_scope and lookup_ancestors. Signed-off-by: Carl Lerche <carllerche@mac.com>
* Use ActiveModel::TestCase base classJeremy Kemper2009-09-241-1/+1
|
* Changed ActiveRecord to use new callbacks and speed up observers by only ↵José Valim2009-09-082-17/+4
| | | | | | notifying events that are actually being consumed. Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Fix warnings in AMoJoshua Peek2009-09-051-45/+1
|
* Fix failing AMo isolated testsJoshua Peek2009-09-052-0/+3
|
* added proc and symbol support to validates_numericality_of [#3049 ↵Kane2009-08-311-0/+18
| | | | | | state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Add validates_format_of :without => /regexp/ option [Elliot Winkler, Peer Allan]Elliot Winkler2009-08-101-0/+29
| | | | | | | | | | [#430 state:resolved] Example : validates_format_of :subdomain, :without => /www|admin|mail/ Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Introduce validates_with to encapsulate attribute validations in a class.Jeff Dean2009-08-091-0/+116
| | | | | | [#2630 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
* Fix exclusive range patch to use begin/end instead of min/max. [#2981 ↵Adam Keys2009-08-081-0/+14
| | | | | | | status:resolved] Signed-off-by: José Valim <jose.valim@gmail.com> Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Simplyfy validates_length_of and remove putsPratik Naik2009-08-081-1/+0
|