aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases/errors_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use private method call assertions in Active Model tests.Kasper Timm Hansen2015-07-101-24/+9
| | | | Also fix Minitest constant reference.
* Remove use of mocha from Active ModelRoque Pinel2015-05-281-23/+45
|
* Adds/Corrects use case for adding an error messageZamith2015-05-041-0/+6
| | | | | I believe this is a use case that was supposed to be supported, and it's a small fix.
* Merge pull request #19021 from morgoth/activemodel-errors-refactoringRafael Mendonça França2015-03-301-0/+6
|\ | | | | Simplify and alias ActiveModel::Errors methods where possible
| * Simplify and alias ActiveModel::Errors methods where possibleWojciech Wnętrzak2015-02-201-0/+6
| |
* | Fix arguments order on assertionCarlos Antonio da Silva2015-03-221-1/+1
| | | | | | | | The expected value comes first. Related to #19465.
* | Fix ActiveModel::Errors#delete return value to stay backward compatibleRadan Skoric2015-03-221-0/+6
|/ | | | | | | | | | | | Rails 5.0 changes to ActiveModel::Errors include addition of `details` that also accidentally changed the return value of `delete`. Since there was no test for that behavior it went unnoticed. This commit adds a test and fixes the regression. Small improvements to comments have also been made. Since `get` is getting deprecated it is better to use `[]` in other methods' code examples. Also, in the module usage example, `def Person.method` was replaced with a more commonly used `def self.method` code style.
* Deprecate `ActiveModel::Errors` `add_on_empty` and `add_on_blank` methodsWojciech Wnętrzak2015-02-191-7/+21
| | | | without replacement.
* Deprecate `ActiveModel::Errors` `get`, `set` and `[]=` methods.Wojciech Wnętrzak2015-02-011-15/+21
| | | | They have inconsistent behaviour currently.
* Fixed duplicating ActiveModel::Errors#detailsWojciech Wnętrzak2015-01-241-1/+1
|
* Add ActiveModel::Errors#detailsWojciech Wnętrzak2015-01-201-0/+42
| | | | | | | | | | | | | | | | To be able to return type of validator, one can now call `details` on Errors instance: ```ruby class User < ActiveRecord::Base validates :name, presence: true end ``` ```ruby user = User.new; user.valid?; user.errors.details => {name: [{error: :blank}]} ```
* Add #key? to ActiveModel::ErrorsGarry Shutler2014-10-141-0/+11
| | | | Mirror Ruby's Hash#key?
* Tests for indifferent access using full_messages_for. Closes #11916Pavel Penkov2014-03-081-0/+7
|
* Update ActiveModel::Errors.has_key? testAdrien Coquio2014-01-221-1/+1
|
* Add failing test for ActiveModel::Errors#has_key? methodAdrien Coquio2014-01-221-0/+5
| | | | From the doc, this method should return false and not nil if there is no errors for this key
* Change all "can not"s to the correct "cannot".T.J. Schuck2014-01-031-33/+33
|
* Convert ActiveModel to 1.9 hash syntax.Patrick Robertson2013-05-011-4/+4
| | | | | I also attempted to fix other styleguide violations such as { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
* Review some tests from AMo::Errors to remove "should" usageCarlos Antonio da Silva2013-03-301-55/+35
| | | | | Also remove duplicated tests for Errors#as_json and minor improvements in some tests.
* Merge pull request #8527 from shockone/patch-1Rafael Mendonça França2013-03-251-0/+20
|\ | | | | Add a method full_messages_for to the Errors class
| * Add a method full_messages_for to the Errors classshock_one2013-03-241-0/+20
| |
* | Add Error#full_message test; Fix typosVipul A M2013-03-221-0/+1
|/ | | | | Introduce test on Error#full_message for attribute with underscores; Fix some typos
* added more accurate test for add_on_emptyAngelo capilleri2013-02-191-0/+7
| | | | | with the current tests, if delete the assignment of is_empty in add_on_empty method the tests not fail. With this test, if we delete is_empty, the test fails
* Covering untested methods for ActiveModel::ErrorsAttila Domokos2013-01-101-0/+53
|
* Actually test that ActiveModel::Errors#add defaults to :invalid.Renato Mascarenhas2012-12-011-1/+1
|
* Call `full_messages` instead of `to_a` in its spec.Renato Mascarenhas2012-12-011-2/+1
|
* use Array() instead flattenVasiliy Ermolovich2012-11-051-1/+39
| | | | | * move ActiveModel::Errors tests to errors_test.rb * add spec coverage for add_on_empty and add_on_blank
* AM::Errors: allow :full_messages parameter for #as_jsonBogdan Gusiev2012-02-201-0/+10
|
* test title changed corresponding to the testprasath2012-02-091-1/+1
|
* replacing ordered hash to ruby hashprasath2012-02-081-1/+1
|
* Fix ActiveModel::Errors#dupPaweł Kondzior2012-01-161-0/+8
| | | | | | | | | Since ActiveModel::Errors instance keeps all error messages as hash we should duplicate this object as well. Previously ActiveModel::Errors was a subclass of ActiveSupport::OrderedHash, which results in different behavior on `dup`, this may result in regression for people relying on it.
* Add ActiveModel::Errors#delete, which was not available after move to use ↵Piotr Sarnacki2012-01-161-0/+7
| | | | delegation
* New #added? method on ActiveModel::ErrorsMartin Svalin2011-10-191-0/+43
| | | The #added? method makes it possible to check if a specific error has been added, using the same parameters as for #add.
* ActiveModel::Errors#generate_message without i18n_scope, and more test cases ↵Martin Svalin2011-10-171-0/+21
| | | | for #add
* Added test for obj.errors.as_jsonLawrence Pit2011-09-091-0/+11
|
* Add ability to get an individual full error message + test for full_messages.Lawrence Pit2011-09-091-2/+18
|
* add has_key? to ActiveModel::ErrorsDamien Mathieu2011-09-061-0/+6
|
* Handle the empty array correctly.thedarkone2011-07-271-0/+1
|
* implementing include? on AM::ErrorsAaron Patterson2011-02-091-0/+6
|
* fix difference between behaviour of blank and emptyHemant Kumar2011-01-051-0/+6
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* ActiveModel::Errors.to_hash returns plain OrderedHash and used in to_json ↵Thilo Utke2010-12-011-0/+5
| | | | | | serialization to properly handle multiple errors per attribute [#5615 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Revert "Fix generation of wrong json string when field has multiple errors"José Valim2010-12-011-10/+0
| | | | This reverts commit a9b666b51d28b2e74da630c31327dee7cbe96d37.
* Fix generation of wrong json string when field has multiple errorsKrekoten' Marjan2010-12-011-0/+10
|
* adding test cases for ActiveModel::ErrorsNeeraj Singh2010-08-031-0/+65
Signed-off-by: José Valim <jose.valim@gmail.com>