aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/validations
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate `ActiveModel::Errors` `add_on_empty` and `add_on_blank` methodsWojciech Wnętrzak2015-02-191-1/+1
| | | | without replacement.
* Merge pull request #16381 from kakipo/validate-length-tokenizerRafael Mendonça França2015-02-131-0/+13
|\ | | | | | | Allow symbol as values for `tokenizer` of `LengthValidator`
| * Allow symbol as values for `tokenize` of `LengthValidator`kakipo2014-08-031-0/+13
| |
* | Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-0315-16/+0
| | | | | | | | onwards.
* | Merge pull request #18439 from mokhan/validates-acceptance-of-arraySean Griffin2015-01-121-0/+6
|\ \ | | | | | | allow '1' or true for acceptance validation.
| * | allow '1' or true for acceptance validation.mo khan2015-01-101-0/+6
| | |
* | | Add test for AM::Validation::Callbacks with :onclaudiob2015-01-111-0/+26
|/ / | | | | | | | | | | | | | | | | | | | | `before_validation` and `after_validation` from ActiveModel::Validation::Callbacks accept an optional `:on` parameter that was not previously documented or tested. For instance given before_validation :do_something, on: :create then `object.valid?(:create)` will invoke `:do_something` while `object.valid?` or `object.valid?(:anything_else)` will not.
* | Deprecate `false` as the way to halt AM validation callbacksclaudiob2015-01-021-3/+17
| | | | | | | | | | | | | | | | | | | | Before this commit, returning `false` in an ActiveModel validation callback such as `before_validation` would halt the callback chain. After this commit, the behavior is deprecated: will still work until the next release of Rails but will also display a deprecation warning. The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
* | Add AM test for after_validation returning falseclaudiob2014-12-141-2/+13
| | | | | | | | | | | | | | | | This stems from https://github.com/rails/rails/pull/17227#discussion_r21641358 It's simply a clarification of the current behavior by which if an `after_validation` ActiveModel callback returns +false+, then further `after_` callbacks **are not halted**.
* | Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-2/+2
| |
* | Remove redundant require of fileAdam892014-11-011-1/+0
|/ | | | | This file was required inside 'test/validators/namespace/email_validator.rb' that's already required here. Therefore I removed the redundant required.
* `only_integer` of `NumericalityValidator` now allows procs and symbolsRobin Mehner2014-06-221-0/+15
|
* Correct typo, add test for validates_absence_of, correct method namesAkshay Vishnoi2014-06-161-3/+4
|
* Add singular and plural form for some validation messagesAbd ar-Rahman Hamidi2014-05-021-3/+15
|
* Completely remove potential global state leaks in ActiveModel tests.Zuhao Wan2014-03-112-9/+11
| | | | ActiveModel tests can now be run in random order.
* Run ActiveModel test suites in random order.Zuhao Wan2014-03-102-6/+10
| | | | | | | | | | 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 everywhere to reset validators in testsKuldeep Aggarwal2014-01-281-1/+1
|
* Use the new clear_validators! api to reset validators in testsCarlos Antonio da Silva2014-01-2715-34/+32
|
* Merge tests about multiple validation contextsCarlos Antonio da Silva2014-01-271-10/+6
|
* Ability to specify multiple contexts when defining a validation.Vince Puzzella2014-01-271-0/+16
| | | | | | Example: validates_presence_of :name, on: [:update, :custom_validation_context]
* Let validates_inclusion_of accept Time and DateTime rangesAkira Matsuda2013-10-231-0/+22
| | | | fixes 4.0.0 regression introduced in 0317b93c17a46d7663a8c36edc26ad0ba3d75f85
* use assert_empty in activemodel conditional validation test casesRajarshi Das2013-09-101-7/+7
|
* Use Range#cover? for Numeric ranges (tests via endpoints) and use ↵Charles Bergeron2013-05-271-0/+1
| | | | | | Range#include? for non-numeric ranges added changelog message
* deprecate Validator#setup (to get rid of a respond_to call). validators do ↵Nick Sutterer2013-05-231-23/+1
| | | | their setup in their constructor now.
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-0112-202/+201
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* Merge pull request #10286 from ↵Carlos Antonio da Silva2013-04-211-2/+2
|\ | | | | | | | | neerajdotname/fix-wrong-test-name-and-failure-message fix wrong test description and failure message
| * fix wrong test description and failure messageNeeraj Singh2013-04-211-2/+2
| |
* | Added tests for if condition in Active Model callbacksNeeraj Singh2013-04-211-0/+21
|/
* fix some typos found in activemodelVipul A M2013-03-181-1/+1
|
* `validates_confirmation_of` does not override writer methods.Yves Senn2013-03-041-0/+31
|
* Take care of whitespaces and changing the hash syntaxRafael Mendonça França2013-02-041-57/+56
|
* test for issue 8931David2013-02-021-0/+8
|
* 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
|