aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
Commit message (Collapse)AuthorAgeFilesLines
* Autosave callbacks shouldn't be `after_save`Agis-2014-10-131-0/+9
| | | | | | | | | | | | 068f092ced8483e557725542dd919ab7c516e567 registered autosave callbacks as `after_save` callbacks. This caused the regression described in #17209. Autosave callbacks should be registered as `after_update` and `after_create` callbacks, just like before. This is a partial revert of 068f092ced8483e557725542dd919ab7c516e567. Fixes #17209.
* Merge pull request #17014 from grosser/grosser/fast-fixturesAaron Patterson2014-10-102-32/+0
|\ | | | | speed up fixtures by not loading all their classes
| * speed up fixtures by not loading all their classesgrosser2014-10-062-32/+0
| |
* | ar/connection_pool: honor overriden rack.test in middlewareSimon Eskildsen2014-09-231-0/+8
| | | | | | | | | | | | | | Honoring an overidden `rack.test` allows testing closed connection between multiple requests. This is useful if you're working on database resiliency, to ensure the connection is in the expected state from one request to another on the same worker.
* | add a truncate method to the connectionAaron Patterson2014-09-222-0/+23
|/ | | | | | it doesn't work on SQLite3 since it doesn't support truncate, but that's OK. If you call truncate on the connection, you're now bound to that database (same as if you use hstore or any other db specific feature).
* Better regression test for Fixtures with fk as a symbolArthur Neves2014-09-221-10/+1
|
* fix fixtures not loading if a belongs_to association is defined with a ↵Will Bryant2014-09-221-0/+9
| | | | :foreign_key option that's a symbol
* Fix assertions in AR::TestCase::AttributeMethodsTestYuki Nishijima2014-09-211-3/+3
| | | | | This test has always been green because it uses "assert" and the first argument is an truthy class/object.
* Fix typo [ci skip]Yuki Nishijima2014-09-201-1/+1
|
* Fix find_by with associations not working with adequate recordGodfrey Chan2014-09-201-0/+5
| | | | | | | | | For now, we will just skip the cache when a non-column key is used in the hash. If the future, we can probably move some of the logic in PredicateBuilder.expand up the chain to make caching possible for association queries. Closes #16903 Fixes #16884
* Merge pull request #15791 from zev/add_model_to_recordnotfound_messageAaron Patterson2014-09-191-10/+18
|\ | | | | Update RecordNotFound exception cases to include a message with the
| * Update RecordNotFound exception cases to include a message with theZev Blut2014-06-181-10/+18
| | | | | | | | Model that the Record was not found in.
* | Merge pull request #16875 from alan/dont_autosave_has_one_through_recordRafael Mendonça França2014-09-171-0/+24
|\ \ | | | | | | | | | | | | | | | | | | Don't autosave unchanged has_one through records Conflicts: activerecord/CHANGELOG.md
| * | Don't autosave unchanged has_one through recordsAlan Kennedy2014-09-151-0/+24
| | |
* | | Allow YAML serialization when using TZ aware attributesSean Griffin2014-09-171-0/+8
| | |
* | | do not dump foreign keys for ignored tables.Yves Senn2014-09-171-0/+5
| | |
* | | pg, correctly dump foreign keys targeting tables in a different schema.Yves Senn2014-09-171-0/+26
|/ / | | | | | | | | | | Closes #16907. [Matthew Draper & Yves Senn]
* | Merge pull request #13656 from chanks/rollback_transactions_in_killed_threadsMatthew Draper2014-09-141-0/+31
|\ \ | | | | | | | | | Data corruption risk: Roll back open transactions when the running thread is killed.
| * | Roll back open transactions when the running thread is killed.Chris Hanks2014-08-221-0/+31
| | |
* | | pg, add test cases for updateable views.Yves Senn2014-09-111-0/+45
| | |
* | | reuse view test-cases for pg materialized view tests.Yves Senn2014-09-112-67/+36
| | |
* | | switch `assert_operator` arguments as discussed in #16860.Yves Senn2014-09-111-1/+1
| | | | | | | | | | | | Working with two different machines is hard :sweat:
* | | A `NullRelation` should represent nothing. Closes #15176.Yves Senn2014-09-112-0/+9
| | | | | | | | | | | | | | | | | | [Matthew Draper & Yves Senn] Closes #16860. (pull request to discuss the implementation)
* | | Merge pull request #16839 from chancancode/default_test_orderRafael Mendonça França2014-09-101-1/+1
|\ \ \ | | | | | | | | | | | | Default to sorting user's test cases for now
| * | | 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
* | | | Speed up schema dumper testsJeremy Kemper2014-09-101-11/+9
| | | | | | | | | | | | | | | | Dump the standard schema once instead of redoing it per test
* | | | Include default column limits in schema.rbJeremy Kemper2014-09-101-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | Allows :limit defaults to be changed without pulling the rug out from under old migrations that omitted :limit because it matched the default at the time.
* | | | MySQL: schema.rb now includes TEXT and BLOB column limits.Jeremy Kemper2014-09-101-4/+4
| | | |
* | | | MySQL: correct LONGTEXT and LONGBLOB limits from 2GB to their true 4GBJeremy Kemper2014-09-101-2/+2
| | | |
* | | | Replace drop sql statement to drop_table methodYasuo Honda2014-09-113-5/+5
| | | | | | | | | | | | | | | | to drop sequences at the same time each tables dropped for Oracle
* | | | Oracle does not support `IF EXISTS` for `DROP VIEW`.Yves Senn2014-09-091-2/+2
| | | | | | | | | | | | | | | | /cc @yahonda
* | | | models backed by views don't assume "id" columns are the primary key.Yves Senn2014-09-091-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #10247. The same goes for tables with an "id" column but without primary key constraint. Reading from the view works without configuration. If you have an updateable view you need to use `self.primary_key = ''`.
* | | | add test-cases for primary-key-less-views. Closes #16555.Yves Senn2014-09-091-0/+43
| | | |
* | | | Merge pull request #14056 from girishso/14041Yves Senn2014-09-092-3/+2
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SQLite3Adapter now checks for views in table_exists? fixes: 14041 Conflicts: activerecord/CHANGELOG.md
| * | | | SQLite3Adapter now checks for views in table_exists? fixes: 14041Girish S2014-02-141-0/+10
| | | | |
* | | | | introduce `connection.supports_views?` and basic view tests.Yves Senn2014-09-091-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `AbstractAdapter#supports_views?` defaults to `false` so we have to turn it on in adapter subclasses. Currently the flag only controls test execution. /cc @yahonda
* | | | | Allow included modules to override association methods.Yves Senn2014-09-092-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Closes #16684. This is achieved by always generating `GeneratedAssociationMethods` when `ActiveRecord::Base` is subclassed. When some of the included modules of `ActiveRecord::Base` were reordered this behavior was broken as `Core#initialize_generated_modules` was no longer called. Meaning that the module was generated on first access.
* | | | | Merge pull request #16827 from kuldeepaggarwal/f-disable-migration-loggingYves Senn2014-09-081-1/+4
|\ \ \ \ \ | |_|/ / / |/| | | | | | | | | disable migrations logging while running test cases for AR schema tests
| * | | | disable migrations logging while running test cases for AR schema testsKuldeep Aggarwal2014-09-061-0/+2
| | | | |
* | | | | Fix query with nested array in Active RecordCristian Bica2014-09-062-1/+31
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | `User.where(id: [[1,2],3])` was equal to `User.where(id:[1, 2, 3])` in Rails 4.1.x but because of some refactoring in Arel this stopped working in 4.2.0. This fixes it in Rails. [Dan Olson & Cristian Bica]
* | | | Dynamically modified schema and association would not be correctly resetAkira Matsuda2014-09-061-16/+9
| | | | | | | | | | | | | | | | | | | | This fixes <"SQLite3::SQLException: no such column: legacy_things.person_id: SELECT \"legacy_things\".* FROM \"legacy_things\" WHERE \"legacy_things\".\"person_id\" = ?"> in OptimisticLockingTest#test_lock_destroy
* | | | Merge pull request #16114 from seuros/test_cleanRafael Mendonça França2014-09-056-25/+24
|\ \ \ \ | | | | | | | | | | [Postgresql tests] Added enable_extension! to helper
| * | | | Added enable_extension! to helperAbdelkader Boudih2014-09-056-25/+24
| | | | |
* | | | | Do not mark object as persisted after an association is savedRafael Mendonça França2014-09-052-19/+14
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Callback order in Active Record objects are important. Users should not define callbacks before the association definition or surprising behaviours like the described at #3798 will happen. This callback order dependency is documented at https://github.com/rails/rails/blob/31bfcdc77ca0d8cec9b5fe513bdc6f05814dd4f1/activerecord/lib/active_record/associations.rb#L1222-1227. This reverts #15728. Fixes #16620.
* | | | Fixed regression with referencing polymorphic assoc in eager-loadGodfrey Chan2014-09-051-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is cased by 03118bc + 9b5d603. The first commit referenced the undefined local variable `column` when it should be using `reflection.type` as the lookup key. The second commit changed `build_arel` to not modify the `bind_values` in- place so we need to combine the arel's `bind_values` with the relation's when building the SQL. Fixes #16591 Related #15821 / #15892 / 7aeca50
* | | | Load :developers fixtures where expecting a Developer to be thereAkira Matsuda2014-09-051-1/+1
| | | |
* | | | Merge pull request #16788 from codeodor/fix-16761Aaron Patterson2014-09-041-1/+20
|\ \ \ \ | | | | | | | | | | Skip StatementCache for eager loaded associations
| * | | | Skip StatementCache for eager loaded associations (Fixes #16761)Sammy Larbi2014-09-041-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Eagerly loaded collection and singular associations are ignored by the StatementCache, which causes errors when the queries they generate reference columns that were not eagerly loaded. This commit skips the creation of the StatementCache as a fix for these scenarios.
* | | | | always reorder bind parameters. fixes #15920Aaron Patterson2014-09-041-1/+8
|/ / / /
* | | | Enums shouldn't ruin people's anniversariesGodfrey Chan2014-09-042-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a few more methods on Module/Class to the dangerous class methods blacklist. (Technically, allocate and new are already protected currently because we happen to redefine them in the current implantation.) Closes #16792