aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
Commit message (Collapse)AuthorAgeFilesLines
* Remove deprecated `ActiveModel::Dirty#reset_#{attribute}` and ↵Rafael Mendonça França2015-01-041-17/+0
| | | | `ActiveModel::Dirty#reset_changes`.
* Deprecate `false` as the way to halt AM callbacksclaudiob2015-01-021-3/+13
| | | | | | | | | | Before this commit, returning `false` in an ActiveModel `before_` callback such as `before_create` 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)`.
* 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)`.
* - Fixed unused variableVipul A M2014-12-211-3/+2
| | | | - Changed test to verify complete message instead of verifying if message contains text.
* Add AM test: after/around callback returning falseclaudiob2014-12-141-4/+15
| | | | | | | | | | | 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_` or `around_` ActiveModel callback returns +false+, then the callback chain **is not halted**. The callback chain in ActiveModel is only halted when a `before_` callback returns `false`.
* 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 through the `prepend` option to `AS::Callback`Godfrey Chan2014-12-121-1/+37
| | | | | | | | | | | | | I'm not sure what's the use case for this, but apparently it broke some apps. Since it was not the intended result from #16210 I fixed it to not raise an exception anymore. However, I didn't add documentation for it because I don't know if this should be officially supported without knowing how it's meant to be used. In general, validations should be side-effect-free (other than adding to the error message to `@errors`). Order-dependent validations seems like a bad idea. Fixes #18002
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-292-3/+3
|
* 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.
* Add #key? to ActiveModel::ErrorsGarry Shutler2014-10-141-0/+11
| | | | Mirror Ruby's Hash#key?
* Added test for exception message for validate methodPrathamesh Sonpatki2014-09-231-1/+3
| | | | - Test case for https://github.com/rails/rails/pull/16851
* Default to sorting user's test cases for nowGodfrey Chan2014-09-081-1/+1
| | | | | | | | | | | Goals: 1. Default to :random for newly generated applications 2. Default to :sorted for existing applications with a warning 3. Only show the warning once 4. Only show the warning if the app actually uses AS::TestCase Fixes #16769
* Leave all our tests as order_dependent! for nowMatthew Draper2014-09-021-0/+5
| | | | | | | | | We're seeing too many failures to believe otherwise. This reverts commits bc116a55ca3dd9f63a1f1ca7ade3623885adcc57, cbde413df3839e06dd14e3c220e9800af91e83ab, bf0a67931dd8e58f6f878b9510ae818ae1f29a3a, and 2440933fe2c27b27bcafcd9019717800db2641aa.
* Move model definition to test/models for test order indenendencyAkira Matsuda2014-08-283-29/+15
|
* [ci skip] make assert messages consistentankit19102014-08-251-2/+2
|
* AM, AP, AV, and AMo tests are already order_independent!Akira Matsuda2014-08-131-5/+0
|
* Nobody sucks so nobody should call this awful method nameRafael Mendonça França2014-08-121-1/+1
|
* users_dont_suck_but_only_we_suck_and_only_our_tests_are_order_dependent!Akira Matsuda2014-08-121-0/+5
| | | | | Calling ActiveSupport::TestCase.i_suck_and_my_tests_are_order_dependent! in AS::TestCase makes everyone's tests order dependent, which should never be done by the framework.
* Allow password to contain spaces only.Yevhene Shemet2014-08-061-0/+10
|
* Merge pull request #15959 from aditya-kapoor/remove-unneeded-casesRafael Mendonça França2014-07-292-26/+17
|\ | | | | remove unneeded test model for ActiveModel test cases.
| * remove unneeded test model for ActiveModel test cases.Aditya Kapoor2014-06-282-26/+17
| |
* | Merge branch 'rm-remove-mocha'Rafael Mendonça França2014-07-191-0/+2
|\ \ | | | | | | | | | | | | Conflicts: actionpack/test/abstract_unit.rb
| * | Stop requiring mocha automaticallyRafael Mendonça França2014-07-191-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We are planning to remove mocha from our test suite because of performance problems. To make this possible we should stop require mocha on ActionSupport::TestCase. This should not affect applications since users still need to add mocha to Gemfile and this already load mocha. Added FIXME notes to place that still need mocha removal
* | | Merge pull request #16210 from sonnym/assert_valid_keys_in_validateMatthew Draper2014-07-181-0/+7
|\ \ \ | | | | | | | | | | | | Check for valid options in validate method
| * | | check for valid options in validate methodsonnym2014-07-171-0/+6
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change prevents a certain class of user error which results when mistakenly using the `validate` class method instead of the `validates` class method. Only apply when all arguments are symbols, because some validations use the `validate` method and pass in additional options, namely the `LenghValidator` via the `ActiveMode::Validations::validates_with` method.
* | | Make restore_attributes publicRafael Mendonça França2014-07-171-5/+15
| | | | | | | | | | | | | | | | | | | | | Also make it accept a list of attributes to be changed. This will make possible to restore only a subset of the changed attributes. Closes #16203
* | | Deprecate `reset_#{attribute}` in favor of `restore_#{attribute}`.Rafael Mendonça França2014-07-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | These methods may cause confusion with the `reset_changes` that behaves differently of them. Also rename undo_changes to restore_changes to match this new set of methods.
* | | Deprecate ActiveModel::Dirty#reset_changes in favor of ↵Rafael Mendonça França2014-07-151-0/+21
|/ / | | | | | | | | | | | | | | | | #clear_changes_information This method name is causing confusion with the `reset_#{attribute}` methods. While `reset_name` set the value of the name attribute for the previous value the `reset_changes` only discard the changes and previous changes.
* | Only automatically include validations when enabledGodfrey Chan2014-07-021-11/+3
| | | | | | | | This is a follow up to #16024.
* | automatically include ActiveModel::Validations when include ↵Aditya Kapoor2014-07-033-2/+5
| | | | | | | | ActiveModel::SecurePassword
* | Rename rollback_changes to undo_changesRafael Mendonça França2014-06-301-2/+2
| | | | | | | | To avoid overload with database rollback
* | Merge pull request #14861 from igor04/dirty-rollbackRafael Mendonça França2014-06-301-0/+18
|\ \ | |/ |/| | | Added rollback method to ActiveModel::Dirty
| * Added rollback method to ActiveModel::Dirtyigor042014-06-231-0/+18
| |
* | Merge pull request #15834 from rmehner/allow_proc_and_symbol_for_only_integerRafael Mendonça França2014-06-261-0/+15
|\ \ | | | | | | Allow proc and symbol as values for `only_integer` of `NumericalityValidator`
| * | `only_integer` of `NumericalityValidator` now allows procs and symbolsRobin Mehner2014-06-221-0/+15
| | |
* | | Merge pull request #15871 from yuki24/add-model-name-instance-methodDavid Heinemeier Hansson2014-06-241-0/+6
|\ \ \ | | | | | | | | Add #model_name instance method to ActiveModel::Naming
| * | | Delegate #model_name method to self.classYuki Nishijima2014-06-221-0/+6
| |/ /
* / / remove unnecessary require for json serialization test casesAditya Kapoor2014-06-241-1/+0
|/ /
* | Correct typo, add test for validates_absence_of, correct method namesAkshay Vishnoi2014-06-161-3/+4
| |
* | Use `@existing_user` while updating existing user, fixing - #ee4e86Akshay Vishnoi2014-06-141-6/+6
| |
* | Cleaned up the `has_secure_password` test casesGodfrey Chan2014-06-141-33/+29
| | | | | | | | | | | | * Grouped the valid test cases in one place * Make the length of the generated password obvious * Removed two wrong (copy-and-pasted) test cases
* | SecurePassword - Validate password must be less than or equal to 72Akshay Vishnoi2014-06-141-0/+28
| | | | | | | | See #14591, Reason - BCrypt hash function can handle maximum 72 characters.
* | [ci skip] add tests for ActionModel::ConversionAditya Kapoor2014-06-111-0/+4
| |
* | remove depricated Validatior#setupKuldeep Aggarwal2014-06-101-21/+0
| |
* | Add singular and plural form for some validation messagesAbd ar-Rahman Hamidi2014-05-021-3/+15
|/
* Fix warning for overshadowing XML variableMusannif Zahir2014-03-281-2/+2
|
* ActiveRecord/ActiveModel '#validate' alias for 'valid?'Henrik Nyh2014-03-271-0/+9
| | | | | | | | It's unintuitive to call '#valid?' when you want to run validations but don't care about the return value. The alias in ActiveRecord isn't strictly necessary (the ActiveModel alias is still in effect), but it clarifies.
* comment why we are modifying global state. [ci skip]Yves Senn2014-03-111-0/+1
|
* Completely remove potential global state leaks in ActiveModel tests.Zuhao Wan2014-03-117-110/+136
| | | | ActiveModel tests can now be run in random order.
* Merge pull request #14315 from zuhao/activemodel_tests_in_random_orderYves Senn2014-03-094-13/+39
|\ | | | | Run ActiveModel test suites in random order.