aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test/cases
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Revert "Leave all our tests as order_dependent! for now"Matthew Draper2015-03-061-5/+0
| | | | | | | | | | | | This reverts commit 2f52f969885b2834198de0045748436a4651a94e. Conflicts: actionmailer/test/abstract_unit.rb actionview/test/abstract_unit.rb activemodel/test/cases/helper.rb activerecord/test/cases/helper.rb activesupport/test/abstract_unit.rb railties/test/abstract_unit.rb
* Merge pull request #19173 from robin850/rbx-buildRafael Mendonça França2015-03-022-0/+11
|\ | | | | Improve the Rubinius build
| * Skip the failing tests on Rubinius for nowRobin Dupret2015-03-021-0/+2
| |
| * Add the platform-specific skip helpers to ActiveModelRobin Dupret2015-03-021-0/+9
| |
* | Follow-up to #10776Robin Dupret2015-02-262-3/+3
|/ | | | | | | | | | The name `ActiveModel::AttributeAssignment::UnknownAttributeError` is too implementation specific so let's move the constant directly under the ActiveModel namespace. Also since this constant used to be under the ActiveRecord namespace, to make the upgrade path easier, let's avoid raising the former constant when we deal with this error on the Active Record side.
* activemodel: make .model_name json encodableIan Ker-Seymer2015-02-241-0/+4
| | | | | | Previously, calling `User.model_name.to_json` would result in an infinite recursion as `.model_name` inherited its `.as_json` behavior from Object. This patch fixes that unexpected behavior by delegating `.as_json` to :name.
* Move the `validate!` method to `ActiveModel::Validations`.Lucas Mazza2015-02-201-0/+19
|
* Deprecate `ActiveModel::Errors` `add_on_empty` and `add_on_blank` methodsWojciech Wnętrzak2015-02-192-8/+22
| | | | without replacement.
* Merge pull request #18634 from morgoth/deprecate-some-errors-methodsRafael Mendonça França2015-02-181-15/+21
|\ | | | | | | Deprecate `ActiveModel::Errors` `get`, `set` and `[]=` methods.
| * Deprecate `ActiveModel::Errors` `get`, `set` and `[]=` methods.Wojciech Wnętrzak2015-02-011-15/+21
| | | | | | | | They have inconsistent behaviour currently.
* | 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-0316-17/+0
| |/ |/| | | | | onwards.
* | Merge pull request #18670 from morgoth/fix-duplicating-errors-detailsYves Senn2015-01-241-1/+1
|\ \ | | | | | | Fixed duplicating ActiveModel::Errors#details
| * | Fixed duplicating ActiveModel::Errors#detailsWojciech Wnętrzak2015-01-241-1/+1
| | |
* | | use attribute assignment module logic during active model initializationEugene Gilburg2015-01-231-1/+3
|/ /
* | ✂️ and 💅 for #10776Sean Griffin2015-01-231-29/+30
| | | | | | | | | | Minor style changes across the board. Changed an alias to an explicit method declaration, since the alias will not be documented otherwise.
* | Extracted `ActiveRecord::AttributeAssignment` to ↵Bogdan Gusiev2015-01-231-0/+106
| | | | | | | | | | | | `ActiveModel::AttributesAssignment` Allows to use it for any object as an includable module.
* | 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}]} ```
* | 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
| | |
* | | Merge pull request #18454 from claudiob/test-on-option-for-amv-callbacksCarlos Antonio da Silva2015-01-111-0/+26
|\ \ \ | | | | | | | | Add test for AM::Validation::Callbacks with :on
| * | | 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.
* / / Remove unused "deprecated_reload" methodclaudiob2015-01-111-4/+0
|/ / | | | | | | | | | | The method was introduced in https://github.com/rails/rails/commit/66d0a0153578ce760d822580c5b8c0b726042ac2#diff-8cec05860729a3851ceb756f4dd90370R49 for the "reset_changes is deprecated" test, but this test was successively removed in https://github.com/rails/rails/commit/37175a24bd508e2983247ec5d011d57df836c743
* | 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-282-29/+0
| |
* | [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-291-13/+17
|\ | | | | remove unneeded test model for ActiveModel test cases.
| * remove unneeded test model for ActiveModel test cases.Aditya Kapoor2014-06-281-13/+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