aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | 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-063-2/+32
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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-064-16/+21
| | | | | | | | | | | | | | | | | | | | 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-057-26/+25
|\ \ \ \ | | | | | | | | | | [Postgresql tests] Added enable_extension! to helper
| * | | | Added enable_extension! to helperAbdelkader Boudih2014-09-057-26/+25
| | | | |
* | | | | 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-043-1/+31
|\ \ \ \ | | | | | | | | | | Skip StatementCache for eager loaded associations
| * | | | Skip StatementCache for eager loaded associations (Fixes #16761)Sammy Larbi2014-09-043-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | schema loading rake tasks maintain database connection for current env.Yves Senn2014-09-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [Joshua Cody & Yves Senn] Closes #16757. Prior to this patch schema loading rake tasks had the potential to leak a connection to a different database. This had side-effects when rake tasks operating on the current connection (like `db:seed`) were chained.
* | | | Reset ActiveRecord::SchemaDumper.ignore_tables value after changed in testsAkira Matsuda2014-09-032-26/+21
| | | |
* | | | Remove 'if exists' from drop table statement then use `table_exists?`Yasuo Honda2014-09-034-6/+6
| | | | | | | | | | | | | | | | | | | | Since 'drop table if exists' statement does not always work with some databases such as Oracle.
* | | | 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.
* | | | MySQL: skip GTID-unsafe statement tests when enforce_gtid_consistency is enabledJeremy Kemper2014-09-013-23/+31
| | | |
* | | | Clear schema cache before each testAkira Matsuda2014-09-011-0/+1
| | | |
* | | | Clear schema cache before each testAkira Matsuda2014-09-011-0/+1
| | | |
* | | | MySQL: set connection collation along with the charsetJeremy Kemper2014-08-303-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sets the connection collation to the database collation configured in database.yml. Otherwise, `SET NAMES utf8mb4` will use the default collation for that charset (utf8mb4_general_ci) when you may have chosen a different collation, like utf8mb4_unicode_ci. This only applies to literal string comparisons, not column values, so it is unlikely to affect you.
* | | | AR#reset_column_information sometimes queries via table_exists?Akira Matsuda2014-08-311-1/+1
| | | | | | | | | | | | | | | | so this assertion causes random test fail
* | | | Don't test PostgreSQL implementation detailsAkira Matsuda & Kohei Suzuki2014-08-291-3/+0
| | | | | | | | | | | | | | | | | | | | Asserting that the message contains "QUERY PLAN" is enough for the adapter's test. The plan may vary according to number of tuples etc. but that's out of our concern.
* | | | Revert "Merge pull request #16254 from ↵Yves Senn2014-08-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | zuhao/refactor_activerecord_attribute_decorators_test" This reverts commit 16fe19831548f108c113094d106663497fc190d5, reversing changes made to 4c81c8ce533896be28bdc0b055ff30bb9dee1316. The call to `Model.reset_column_information` was to express the intent of the test. `reset_column_information` itself can trigger SQL queries because it checks for a tables existance. Let's move it outside of the block. /cc @sgrif
* | | | Reset ActiveRecord::Migration.message_count counter before start testingAkira Matsuda2014-08-291-1/+1
| | | |
* | | | Bring original puts back after finishing testsAkira Matsuda2014-08-292-4/+12
| | | |
* | | | Silence another test that runs migrationsAkira Matsuda2014-08-291-0/+5
| | | |
* | | | MigrationTest doesn't need to be verbose anymoreAkira Matsuda2014-08-291-1/+1
| | | |
* | | | No tests are dealing with ActiveRecord::Migration.message_count here anymoreAkira Matsuda2014-08-291-1/+0
| | | |
* | | | Reset ActiveRecord::Migration.verbose to the value beforeAkira Matsuda2014-08-292-2/+5
| | | |
* | | | Demodulize ActiveRecord::MigratorTestAkira Matsuda2014-08-291-284/+282
| | | |
* | | | No transaction for a test that creates fixtures in the test bodyAkira Matsuda2014-08-291-0/+1
| | | |
* | | | User Model#last to certainly get lastly created dataAkira Matsuda2014-08-281-1/+1
| | | | | | | | | | | | | | | | This test would fail when executed after any test that calls fixtures(:binaries)
* | | | Move association definition to the model fileAkira Matsuda2014-08-282-2/+1
| | | |
* | | | Be sure that test fixtures satisfy referential integrity before calculatingAkira Matsuda2014-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There exists some other test files that load :minivans fixtures but don't load :speedometers. Loading :speedometers here prevents the following error when this test was run after such test: CalculationsTest#test_should_group_by_association_with_non_numeric_foreign_key: ActiveRecord::RecordNotFound: Couldn't find all Speedometers with 'speedometer_id': (ABC, s1) (found 1 results, but was looking for 2)
* | | | Ignore SCHEMA queries when asserting no queriesAkira Matsuda2014-08-285-22/+22
| | | |
* | | | Reset schema properly after schema changing testAkira Matsuda2014-08-281-0/+2
| | | |
* | | | Correctly detect mutation on serialized columns mapping to binarySean Griffin2014-08-271-0/+16
| | | | | | | | | | | | | | | | Fixes #16701
* | | | Override #find_by! in core to enable AST cachingGodfrey Chan2014-08-251-0/+22
| | | |
* | | | Fixed find_by("sql fragment without bindings") on masterGodfrey Chan2014-08-253-16/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Also duplicated find_by tests from relations_test.rb to finder_test.rb now that we have a completely different implementation on the class (in core.rb with AST caching stuff). * Also removed a (failing) test that used mocks. Now that we have tests for the behavior, there's no point having another test that tests the implementation (that it delegates). Further, what the test was implying is nolonger true with the current implementation, because Class.find_by is a real method now.
* | | | pg, `default_sequence_name` needs to return a string.Yves Senn2014-08-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a reacon to https://github.com/rails/rails/commit/d6c1205584b1ba597db4071b168681678b1e9875#commitcomment-7502487 This backwards incompatibility was introduced with d6c12055 to fix #7516. However both `connection.default_sequence_name` and `model.sequence_name` are public API. The PostgreSQL adapter should honor the interface and return strings. /cc @matthewd @chancancode
* | | | Don't trim excess whitespace in pg #columns_for_distinctAgis-2014-08-241-0/+8
| | | | | | | | | | | | | | | | Fixes #16623 introduced by https://github.com/rails/rails/commit/3d5a2019bcccc6fb01bee4811ca669f4383edb51
* | | | adding the exception RecordNotFound to UUID findJoseLuis Torres2014-08-212-1/+15
| |/ / |/| |
* | | "warning: assigned but unused variable"Akira Matsuda2014-08-211-1/+1
| | |