| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| | |
Stop using Mocha
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Six Mocha calls prove quite resistant to Minitestification. For example,
if we replace
```
ActiveRecord::Associations::HasManyAssociation
.any_instance
.expects(:reader)
.never
```
with `assert_not_called`, Minitest wisely raises
```
NameError: undefined method `reader' for class `ActiveRecord::Associations::HasManyAssociation'
```
as `:reader` comes from a deeply embedded abstract class,
`ActiveRecord::Associations::CollectionAssociation`.
This patch tackles this difficulty by adding
`ActiveSupport::Testing::MethodCallAsserts#assert_called_on_instance_of`
which injects a stubbed method into `klass`, and verifies the number of
times it is called, similar to `assert_called`. It also adds a convenience
method, `assert_not_called_on_instance_of`, mirroring
`assert_not_called`.
It uses the new method_call_assertions to replace the remaining Mocha
calls in `ActiveRecord` tests.
[utilum + bogdanvlviv + kspath]
|
| | |
|
| |
| |
| |
| | |
This was introduced at 24f6bf0d96b58f2b2ef6a886c93d35cf8ce4f293.
|
| |
| |
| |
| | |
https://github.com/rails/rails/issues/31190
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The `Relation::Merger` has a problem that order values would be merged
as nested array.
That was caused an issue #33664 since if array value is passed to
`order` and first element in the array includes `?`, the array is
regarded as a prepared statement and bind variables.
https://api.rubyonrails.org/classes/ActiveRecord/Sanitization/ClassMethods.html#method-i-sanitize_sql_for_order
Just merging that as splat args like other values would fix the issue.
Fixes #33664.
|
|\ \
| | |
| | | |
Improve tests for ActiveRecord::ConnectionAdapters::ConnectionPool co…
|
| | | |
|
| | |
| | |
| | |
| | | |
configurations.
|
|\ \ \
| | | |
| | | | |
Improve test case to test enum correctly
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
without define the enum in class “SpecialBook”, any string status will be casted to integer 0. Then the test have no meaning.
[Rich Chen]
|
|/ / /
| | |
| | |
| | | |
Fixes #33520.
|
|/ /
| |
| |
| | |
https://travis-ci.org/rails/rails/jobs/417783260#L1173-L1179
|
| |
| |
| |
| |
| | |
If `foreign_keys` is fetched before alter table, it couldn't notice
whether foreign keys are broken or not after alter table.
|
| |
| |
| |
| | |
To prevent style check in review like https://github.com/rails/rails/pull/33608#discussion_r211087605.
|
|\ \
| | |
| | |
| | | |
SQLite3 adapter `alter_table` method restores foreign keys
|
| | |
| | |
| | |
| | | |
Related to #33520
|
|\ \ \
| | | |
| | | | |
Fix numericality validator not to be affected by custom getter
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Since fe9547b6, numericality validator would parse raw value only when a
value came from user to work type casting to a value from database.
But that was caused a regression that the validator would work against
getter value instead of parsed raw value, a getter is sometimes
customized by people. #33550
There we never guarantees that the value before type cast was going to
the used in this validation (actually here is only place that getter
value might not be used), but we should not change the behavior unless
there is some particular reason.
The purpose of fe9547b6 is to work type casting to a value from
database. We could achieve the purpose by using `read_attribute`,
without using getter value.
Fixes #33550.
|
|\ \ \
| | | |
| | | | |
use BacktraceCleaner for ActiveRecord verbose logging
|
| |/ / |
|
| | | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
- Move changelog entry of #33530 up in order to preserve the chronology
since we always add new entries on the top of a changelog file.
- Clarify the changelog entry
- Clarify the docs of remove_foreign_key
- Ensure reversible of `remove_foreign_key` with `:primary_key` and `:to_table`
options.
|
|\ \ \
| | | |
| | | | |
33515 invert remove foreign key support "to_table"
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
remove_foreign_key supports
- remove_foreign_key :accounts, :branches
- remove_foreign_key :accounts, to_table: :branches
but the second one is not reversible.
This branch is to fix and allow second one to be reversible.
[Nikolay Epifanov, Rich Chen]
|
|/ / |
|
|/
|
|
|
|
| |
The first thing this method does is run on the argument. This change passes
in a string so we don't allocate a bunch of unnecessary extra strings by
calling to_s on a symbol over and over.
|
| |
|
| |
|
|\
| |
| | |
Call build when extend with nested attributes defined
|
| |
| |
| |
| |
| |
| |
| |
| | |
What?
From now on when `accepts_nested_attributes_for` defined and `extend` option
added the overwritten `build` method being called.
[Alireza Bashiri, Martins Polakovs]
|
|\ \
| | |
| | |
| | |
| | | |
albertoalmagro/change-references-from-rake-to-rails-command
Change references from Rake task to Rails command
|
| | |
| | |
| | |
| | |
| | | |
This commit follows the path we started at commit #ea4f0e2
and continued at PR #33229.
|
| |/
|/| |
|
|/
|
|
| |
load_schema
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit d162188dd662a7d9f62ba8431474f50bc35e3e93, reversing
changes made to 3576782888c307e3e192c44e332b957cd1174128.
Reason: #24131 conflicts the #5153's default order contract, it means
that existing apps would be broken by that change.
We don't want to break existing apps without a deprecation cycle.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since 9ac7dd4, class level `update`, `destroy`, and `delete` were placed
in the `Persistence` module as class methods.
But `Relation#update` without passing ids which was introduced at #11898
is not a class method, and it was caused the extra scoping regression
#33470.
I moved the relation method back into the `Relation` to fix the
regression.
Fixes #33470.
|
|
|
|
| |
violations on delete
|
|
|
|
| |
To make it easier to construct boundable predicate.
|
|
|
|
|
|
| |
The target object for counter cache is not always determined by the
primary key value on the model. I'd like to extract `update_couters`
onto the `Relation` for the internal use.
|
| |
|
|
|
|
| |
`5 =~ /\d/` returns nil, but Integer doesn't have a `match?` method.
|
|
|
|
|
| |
In cases where the MatchData object is not used, this provides a speed-up:
https://github.com/JuanitoFatas/fast-ruby/#stringmatch-vs-stringmatch-vs-stringstart_withstringend_with-code-start-code-end
|
|
|
|
| |
Clean up some concepts in the code while we're here.
|
|
|
|
| |
source is ignored (#33455)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* PostgreSQL 10 new relkind for partitioned tables
Starting with PostgreSQL 10, we can now have partitioned tables natively
* Add comment
* Remove extra space
* Add test for partition table in postgreSQL10
* Select 'p' for "BASE TABLE" and add a test case
to support PostgreSQL 10 partition tables
* Address RuboCop offense
* Addressed incorrect `postgresql_version`
Fixes #33008.
[Yannick Schutz & Yasuo Honda & Ryuta Kamizono]
|
|
|
|
|
|
|
|
|
|
| |
PR#32381 added Rubocop's comments to some tests files in order to
exclude `Performance/RedundantMerge`.
Turn off `Performance` cops for tests files via `Exclude`
in `.rubocop.yml`.
Context https://github.com/rails/rails/pull/32381#discussion_r205212331
|
|\
| |
| | |
Turn on performance based cops
|