aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases
Commit message (Collapse)AuthorAgeFilesLines
...
* | | 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-031-0/+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.
| * Run ActiveModel test suites in random order.Zuhao Wan2014-03-104-13/+39
| | | | | | | | | | | | | | | | | | | | 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.
* | Tests for indifferent access using full_messages_for. Closes #11916Pavel Penkov2014-03-081-0/+7
|/
* Fix some validators when used on model instanceEric Hutzelman2014-02-261-1/+2
| | | | | | | | Now that Validator #setup is called from the initializer, we need a reference to the model's class to be passed in to allow the validators to continue functioning when used at the instance level. Closes #14134.
* add test coverage for activemodel Dirty#reset_changesDmitry Polushkin2014-02-091-0/+19
|
* `#to_param` returns `nil` if `to_key` returns `nil`. Closes #11399.Yves Senn2014-02-041-0/+10
| | | | | | | | | | | | | | | | The documentation of `#to_key` (http://api.rubyonrails.org/classes/ActiveModel/Conversion.html#method-i-to_key) states that it returns `nil` if there are no key attributes. `to_param` needs to be aware of that fact and return `nil` as well. Previously it raised the following exception: ``` 1) Error: ConversionTest#test_to_param_returns_nil_if_to_key_is_nil: NoMethodError: undefined method `join' for nil:NilClass /Users/senny/Projects/rails/activemodel/lib/active_model/conversion.rb:65:in `to_param' /Users/senny/Projects/rails/activemodel/test/cases/conversion_test.rb:34:in `block in <class:ConversionTest>' ```
* 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-2716-42/+33
|
* 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]
* Some minor fixesGodfrey Chan2014-01-241-1/+0
|
* Removed old testsGodfrey Chan2014-01-242-239/+121
|
* Rewrote the tests for has_secure_passwordGodfrey Chan2014-01-241-0/+181
|
* 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
* Fix typoRafael Mendonça França2014-01-211-1/+1
|
* When applying changes or reseting changes create the right classRafael Mendonça França2014-01-201-0/+8
| | | | | | | Before this patch after the changes are applied the changes can be only accessed using string keys, but before symbols are also accepted. After this change every state of the model will be consistent.
* Change all "can not"s to the correct "cannot".T.J. Schuck2014-01-031-33/+33
|
* Merge pull request #13131 from gja/changed-accepts-valuesGodfrey Chan2013-12-301-0/+10
|\ | | | | Allows you to check if a field has changed to a particular value
| * Allows you to check if an attribute has changed to a particular valueTejas Dinkar2013-12-151-0/+10
| | | | | | | | model.name_changed?(from: "Pete", to: "Ringo")
* | Disable locale checks to avoid warnings in Active Model tests [ci skip]Carlos Antonio da Silva2013-12-231-0/+3
|/ | | | | Missed AMo when adding to the other components in ae196e85ee7169700afac2eecdc276bc06b10b8d.
* Merge pull request #13273 from robertomiranda/test-remove-requireGuillermo Iguaran2013-12-111-1/+0
|\ | | | | Remove require 'models/administrator', Administrator is not used in secure password test
| * Remove require 'models/administrator', Administrator is not used in secure ↵robertomiranda2013-12-111-1/+0
| | | | | | | | password test
* | Let validates_inclusion_of accept Time and DateTime rangesAkira Matsuda2013-10-231-0/+22
| | | | | | | | fixes 4.0.0 regression introduced in 0317b93c17a46d7663a8c36edc26ad0ba3d75f85
* | Use bcrypt's public cost attr, not internal constantT.J. Schuck2013-10-101-0/+8
| | | | | | | | | | | | | | | | See: - https://github.com/codahale/bcrypt-ruby/pull/63 - https://github.com/codahale/bcrypt-ruby/pull/64 - https://github.com/codahale/bcrypt-ruby/pull/65
* | Merge pull request #8791 from griffinmyers/masterRafael Mendonça França2013-10-031-1/+16
|\ \ | | | | | | | | | | | | | | | | | | Updated DirtyModel's @changed_attributes hash to be symbol/string agnostic Conflicts: activemodel/CHANGELOG.md
| * | DirtyModel uses a hash to keep track of any changes made to attributesWilliam Myers2013-05-271-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | of an instance. When using the attribute_will_change! method, you must supply a string and not a symbol or the *_changed? method will break (because it is looking for the attribute name as a string in the keys of the underlying hash). To remedy this, I simply made the underlying hash a HashWithIndifferentAccess so it won't matter if you supply the attribute name as a symbol or string to attribute_will_change!.