aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations
Commit message (Collapse)AuthorAgeFilesLines
* Add CHANGELOG entry for #8622Rafael Mendonça França2012-12-261-2/+2
|
* Revert the change at ActiveModel::Errors#add_on_blank and fix in theRafael Mendonça França2012-12-261-5/+5
| | | | | | | | | | | right place. The EachValidator#validate already handle :allow_blank and :allow_nil, correctly. Closes #8622. Fix #8621.
* Tests and fix for validates_presence of :allow_nil, :allow_blankColin Kelley2012-12-261-0/+34
| | | | | Conflicts: activemodel/lib/active_model/errors.rb
* Add `ActiveModel::Validations::AbsenceValidator`, a validator to check the ↵Roberto Vasquez Angel2012-12-151-0/+67
| | | | | | absence of attributes. Add `ActiveModel::Errors#add_on_present` method. Adds error messages to present attributes.
* Length validation handles correctly nil. Fix #7180Michal Zima2012-11-261-0/+39
| | | | When nil or empty string are not allowed, they are not valid.
* 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
* Raise ArgumentError when no attribute is given to AMo::EachValidatorCarlos Antonio da Silva2012-11-041-1/+1
| | | | ArgumentError is better suited than RuntimeError for this.
* convert comments to 1.9 hash syntaxAvnerCohen2012-10-222-13/+13
|
* Fix method redefined warnings.kennyj2012-08-292-0/+6
|
* Accept a symbol for `:in` option on inclusion and exclusion validatorsGabriel Sobrinho2012-08-242-0/+44
|
* fix typo in callbacks testAccessd2012-07-241-2/+2
|
* Don't pass `:within` option to the i18nRafael Mendonça França2012-07-201-0/+22
|
* `validates_inclusion_of` and `validates_exclusion_of` now acceptRafael Mendonça França2012-07-202-0/+20
| | | | | | `:within` option as alias of `:in` as documented. Fix #7118
* prevent users from unknowingly using bad regexps that can compromise ↵MrBrdo2012-06-142-6/+16
| | | | security (http://homakov.blogspot.co.uk/2012/05/saferweb-injects-in-various-ruby.html)
* Support i18n attributes for confirmationBrian Cardarella2012-04-242-2/+21
|
* confirmation validation error attributeBrian Cardarella2012-04-234-9/+14
| | | | | | | | | | | | 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.
* To infinity… and beyond!Niels Ganser2012-02-061-0/+18
| | | | | | | Allow infinite values for validates_length_of. Particularly useful for prettily defining an open ended range such as validates_length_of :human_stupidity, :within => 0..Float::INFINITY
* Removing unwanted method and adding to accessor for getter historyprasath2012-01-251-4/+3
|
* added :other_than => :!= option to numericality validatorJakub Kuźma2011-12-211-0/+7
|
* Remove dead code from AMo.José Valim2011-12-201-47/+37
|
* Fixed test "ArgumentError: wrong number of arguments(1 for 0)"Arun Agrawal2011-12-171-1/+1
|
* Fixed bug when error message is an empty string.Antonio Roberto2011-12-161-0/+6
|
* Update variable's name in the test case to reflect the class we're testingPrem Sichanugrist2011-11-183-24/+24
|
* Follow code conventions on some testsSebastian Martinez2011-05-104-29/+29
|
* No need to rescue here. Invoking the wrong method in an object can happen ↵José Valim2011-04-113-34/+0
| | | | anywhere if you are not careful. In other words, test your shit.
* Revert "Add :use_include option to allow user to explicitly use ↵José Valim2011-04-112-19/+0
| | | | | | | | `Range#include?` method in Ruby 1.9" Use :with => range.to_a instead. This reverts commit f6540211b5b9133c9f93c11655a04d613c237e67.
* Add :use_include option to allow user to explicitly use `Range#include?` ↵Prem Sichanugrist2011-04-102-0/+19
| | | | | | method in Ruby 1.9 In Ruby 1.9 we're currently use `Range#cover?` to fix the performance problem. However, there might be the case that you want to use `Range#include?` instead. This patch will give you that option.
* Add support for proc or lambda as an option for InclusionValidator, ↵Prem Sichanugrist2011-04-103-0/+82
| | | | | | ExclusionValidator, and FormatValidator You can now use a proc or lambda in :in option for InclusionValidator and ExclusionValidator, and :with, :without option for FormatValidator
* Refactor length validationSantiago Pastorino2011-03-121-3/+3
|
* length validation for fixnumsAndriy Tyurnikov2011-03-121-0/+11
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Active Model typos.R.T. Lechow2011-03-051-1/+1
|
* 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.
* Change validates inclusion to use cover? for Ranges in ruby 1.9 [#6453 ↵Frederick Cheung2011-02-181-0/+9
| | | | | | state:committed] Signed-off-by: Xavier Noria <fxn@hashref.com>
* Optionally pass in the attribute being validated to an instance method validatorCarl Lerche2011-02-051-0/+9
|
* Be able to pass a validator method to #validatesCarl Lerche2011-02-051-0/+12
|
* Provide a way to specify alternate option keys for validatesCarl Lerche2011-02-051-0/+11
|
* Do not require that validation attributes be specified as symbolsCarl Lerche2011-02-051-0/+11
|
* 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]