| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
It was removed when we removed mocha at
5a6ae7f7539216931f2b3f4aa53394ac4136c74e
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The test was skipped because of an issue that, in the meantime,
has been fixed: https://github.com/rubinius/rubinius/issues/3328.
Using the latest Rubinius (the one currently on Travis CI), this
is the result:
```sh
$ ruby --version
rubinius 2.5.3 (2.1.0 2482b093 2015-05-10 3.5.1 JI) [x86_64-darwin14.3.0]
```
**Before this PR**
```sh
$ ruby -Itest test/cases/attribute_assignment_test.rb
Run options: --seed 58569
.....S...
Finished in 0.048278s, 186.4203 runs/s, 269.2738 assertions/s.
9 runs, 13 assertions, 0 failures, 0 errors, 1 skips
You have skipped tests. Run with --verbose for details.
```
**After this PR**
$ ruby -Itest test/cases/attribute_assignment_test.rb
Run options: --seed 35720
.........
Finished in 0.029441s, 305.6961 runs/s, 475.5273 assertions/s.
9 runs, 14 assertions, 0 failures, 0 errors, 0 skips
```
|
|
|
|
|
| |
I believe this is a use case that was supposed to be supported, and it's
a small fix.
|
|
|
|
| |
`ActiveModel::Serialization#serializable_hash`
|
|
|
|
|
|
|
|
| |
`ActiveModel::Dirty#[attr_name]_previous_change` to improve access
to recorded changes after the model has been saved.
It makes the dirty-attributes query methods consistent before and after
saving.
|
|\
| |
| | |
Simplify and alias ActiveModel::Errors methods where possible
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| | |
As demonstrated by #19570, this option is severely limited, and
satisfies an extremely specific use case. Realistically, there's not
much reason for this option to exist. Its functionality can be trivially
replicated with a normal Ruby method. Let's deprecate this option, in
favor of the simpler solution.
|
| |
| |
| |
| | |
The expected value comes first. Related to #19465.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
|\ \
| | |
| | | |
Improve the Rubinius build
|
| | | |
|
| | | |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
without replacement.
|
|\
| |
| |
| | |
Deprecate `ActiveModel::Errors` `get`, `set` and `[]=` methods.
|
| |
| |
| |
| | |
They have inconsistent behaviour currently.
|
|\ \
| | |
| | |
| | | |
Allow symbol as values for `tokenizer` of `LengthValidator`
|
| | | |
|
| |/
|/|
| |
| | |
onwards.
|
|\ \
| | |
| | | |
Fixed duplicating ActiveModel::Errors#details
|
| | | |
|
|/ / |
|
| |
| |
| |
| |
| | |
Minor style changes across the board. Changed an alias to an explicit
method declaration, since the alias will not be documented otherwise.
|
| |
| |
| |
| |
| |
| | |
`ActiveModel::AttributesAssignment`
Allows to use it for any object as an includable module.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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}]}
```
|
|\ \
| | |
| | | |
allow '1' or true for acceptance validation.
|
| | | |
|
|\ \ \
| | | |
| | | | |
Add test for AM::Validation::Callbacks with :on
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
`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.
|
|/ /
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| | |
`ActiveModel::Dirty#reset_changes`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)`.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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)`.
|
| |
| |
| |
| | |
- Changed test to verify complete message instead of verifying if message contains text.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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`.
|
| |
| |
| |
| |
| |
| |
| |
| | |
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**.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| | |
|
| |
| |
| |
| |
| | |
This file was required inside 'test/validators/namespace/email_validator.rb'
that's already required here. Therefore I removed the redundant required.
|
| |
| |
| |
| | |
Mirror Ruby's Hash#key?
|
| |
| |
| |
| | |
- Test case for https://github.com/rails/rails/pull/16851
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We're seeing too many failures to believe otherwise.
This reverts commits bc116a55ca3dd9f63a1f1ca7ade3623885adcc57,
cbde413df3839e06dd14e3c220e9800af91e83ab,
bf0a67931dd8e58f6f878b9510ae818ae1f29a3a, and
2440933fe2c27b27bcafcd9019717800db2641aa.
|