aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/base_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #26634 from kamipo/extract_numeric_dataRafael França2017-05-311-74/+0
|\ | | | | Extract `NumericData` model for tests
| * Extract `NumericDataTest` to `test/cases/numeric_data_test.rb`Ryuta Kamizono2016-12-221-68/+0
| | | | | | | | | | To ease to find the numeric data tests, extract `NumericDataTest` to `test/cases/numeric_data_test.rb` dedicated file.
| * Extract `NumericData` model for testsRyuta Kamizono2016-09-271-7/+1
| | | | | | | | Currently `NumericData` model is defined some places.
* | Restore `fixtures :author_addresses`Ryuta Kamizono2017-04-271-1/+1
| | | | | | | | | | This change reverted in eac6f369 but it is needed for data integrity. See #25328.
* | Revert "Merge pull request #27636 from ↵Rafael Mendonça França2017-04-261-1/+1
| | | | | | | | | | | | | | | | | | mtsmfm/disable-referential-integrity-without-superuser-privilege-take-2" This reverts commit c1faca6333abe4b938b98fedc8d1f47b88209ecf, reversing changes made to 8c658a0ecc7f2b5fc015d424baf9edf6f3eb2b0b. See https://github.com/rails/rails/pull/27636#issuecomment-297534129
* | Merge pull request #28161 from bogdanvlviv/add_test_attributesRafael França2017-04-181-0/+11
|\ \ | | | | | | Add test for method `#attributes`
| * | Add test for method `#attributes`bogdanvlviv2017-02-251-0/+11
| | | | | | | | | | | | | | | | | | ActiveRecord::AttributeMethods#attributes Extracted from https://github.com/rails/rails/pull/28159
* | | Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser ↵Fumiaki MATSUSHIMA2017-03-261-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | privileges (take 2) Re-create https://github.com/rails/rails/pull/21233 eeac6151a5 was reverted (127509c071b4) because it breaks tests. ---------------- ref: 72c1557254 - We must use `authors` fixture with `author_addresses` because of its foreign key constraint. - Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
* | `primary_key` and `references` columns should be identical typeRyuta Kamizono2017-02-071-0/+7
| | | | | | | | | | | | | | | | Follow up to #26266. The default type of `primary_key` and `references` were changed to `bigint` since #26266. But legacy migration and sqlite3 adapter should keep its previous behavior.
* | Revert "Merge pull request #21233 from ↵Rafael Mendonça França2017-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | mtsmfm/disable-referential-integrity-without-superuser-privileges" This reverts commit eeac6151a55cb7d5f799e1ae33aa64a839cbc3aa, reversing changes made to 5c40239d3104543e70508360d27584a3e4dc5baf. Reason: Broke the isolated tests. https://travis-ci.org/rails/rails/builds/188721346
* | Merge pull request #21233 from ↵Rafael França2017-01-031-1/+1
|\ \ | | | | | | | | | | | | mtsmfm/disable-referential-integrity-without-superuser-privileges Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser privileges
| * | Use `SET CONSTRAINTS` for `disable_referential_integrity` without superuser ↵Fumiaki MATSUSHIMA2016-12-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | privileges ref: 72c1557254 - We must use `authors` fixture with `author_addresses` because of its foreign key constraint. - Tests require PostgreSQL >= 9.4.2 because it had a bug about `ALTER CONSTRAINTS` and fixed in 9.4.2.
* | | Merge pull request #27335 from kamipo/remove_duplicated_model_definitionSean Griffin2017-01-031-10/+1
|\ \ \ | | | | | | | | Remove duplicated model class definitions in `test/cases/base_test.rb`
| * | | Remove duplicated model class definitions in `test/cases/base_test.rb`Ryuta Kamizono2016-12-121-10/+1
| |/ /
* | | Remove deprecated `#uniq`, `#uniq!`, and `#uniq_value`Ryuta Kamizono2016-12-301-6/+0
| | |
* | | Remove deprecated support to query using commas on LIMITRafael Mendonça França2016-12-291-12/+2
| | |
* | | "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-1/+1
|/ /
* | allow ActiveRecord::Core#slice to use array argCohen Carlisle2016-10-311-0/+10
| |
* | Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-14/+14
|/
* improve error message when include assertions failMichael Grosser2016-09-161-1/+1
| | | | | | assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
* Add three new rubocop rulesRafael Mendonça França2016-08-161-3/+3
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Pass along original attribute to save later recursionAaron Patterson2016-08-141-0/+7
| | | | Fixes #26122
* Fix broken alignments caused by auto-correct commit 411ccbdRyuta Kamizono2016-08-101-1/+2
| | | | Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-12/+10
|
* modernizes hash syntax in activerecordXavier Noria2016-08-061-53/+53
|
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-123/+123
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Removed a forgotten `with_exclusive_scope` test:Edouard CHIN2016-06-241-6/+0
| | | | - `with_exclusive_scope` was removed in this commit d242e467819a428ad7e302968e4c9fa1e26d9326
* Remove unnecessary model requiresJon Moss2016-06-101-2/+0
|
* `ActiveRecord::Base#hash` should differ between classesSean Griffin2016-05-311-0/+4
| | | | | | | | Prior to this change, we would get collisions if Active Record objects of different classes with the same ID were used as keys of the same hash. It bothers me slightly that we have to allocate inside of this method, but Ruby doesn't provide any way to hash multiple values without allocation
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-2/+2
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Revert "Deprecate table names containing dots"Sean Griffin2016-03-311-8/+0
| | | | | | This reverts commit 7b82e1c77b48cb351da4e0ed6ea0bac806d4925c. This would have removed the ability to reference a schema when using PG
* Deprecate table names containing dotsSean Griffin2016-03-311-0/+8
| | | | | | | | Dots have special meaning in most backends (e.g. everything except SQLite3), as well as most methods that work with table or column names. This isn't something that we ever explicitly supported, but there's at least one case of somebody using this (see #24367), so we'll go through a deprecation cycle as normal.
* Typos in AR testsAkira Matsuda2016-02-031-1/+1
|
* Active scopes apply to child classes, though not parents/siblingsMatthew Draper2016-01-121-2/+3
| | | | | | | While the commit message (and changelog example) in 5e0b555b453ea2ca36986c111512627d806101e7 talked about sibling classes, the added test had a child ignore its parent's scoping, which seems less reasonable.
* Fixes LoggerSilence#silence threadsafetyCarl P. Corliss2015-12-231-0/+1
| | | | | | | - uses instance defined level if no custom local log level defined - Keeps track of local log level per [ thread + object-instance ] - prevents memory leakage by removing local level hash key/value on #silence method exit - avoids the use of Thread local variables
* Remove legacy mysql adapterRyuta Kamizono2015-12-211-1/+0
| | | | Follow up to #22642.
* Merge pull request #22653 from matthewd/find_array_orderedMatthew Draper2015-12-181-1/+2
|\ | | | | | | ActiveRecord::Base#find(array) returning result in the same order as the array passed
| * [#20338] improving implementation, fixing and adding some more specsMiguel Grazziotin2015-06-031-1/+2
| |
* | Remove legacy mysql adapterAbdelkader Boudih2015-12-171-1/+1
| |
* | Fix test failures on WindowsSean Griffin2015-12-161-4/+12
| | | | | | | | | | | | | | Unlike unix, the TZ variable on Windows does not look at a database. It is always expected to be in the form {Standard Time Abbreviation}{UTC-Offset}{Daylight Time Abbriviation}. This changes the relevant tests to use the Windows form when run from Windows.
* | Use a bind param for `LIMIT` and `OFFSET`Sean Griffin2015-12-141-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently generate an unbounded number of prepared statements when `limit` or `offset` are called with a dynamic argument. This changes `LIMIT` and `OFFSET` to use bind params, eliminating the problem. `Type::Value#hash` needed to be implemented, as it turns out we busted the query cache if the type object used wasn't exactly the same object. This drops support for passing an `Arel::Nodes::SqlLiteral` to `limit`. Doing this relied on AR internals, and was never officially supported usage. Fixes #22250.
* | Deprecate limit strings with commasSean Griffin2015-12-141-3/+7
| | | | | | | | | | | | | | | | | | | | Some backends allow `LIMIT 1,2` as a shorthand for `LIMIT 1 OFFSET 2`. Supporting this in Active Record massively complicates using bind parameters for limit and offset, and it's trivially easy to build an invalid SQL query by also calling `offset` on the same `Relation`. This is a niche syntax that is only supported by a few adapters, and can be trivially worked around by calling offset explicitly.
* | add `ActiveRecord::Base.has_attribute?`Yves Senn2015-12-021-0/+13
| | | | | | | | `has_attribute?` method to check wether a given attribute has been defined.
* | Require only necessary concurrent-ruby classes.Jerry D'Antonio2015-11-041-1/+1
| |
* | Move some AR test cases to inheritance_test.rbyui-knk2015-10-311-79/+0
| | | | | | | | | | | | | | | | These methods are defined in inheritance.rb * `abstract_class?` * `descends_from_active_record?` * `compute_type`
* | Fix typo in ignored_columns test [skip ci]Jon Atack2015-09-241-1/+1
| | | | | | | | Follow-up to #21720.
* | Implement ActiveRecord::Base.ignored_columnsJean Boussier2015-09-241-0/+18
| |
* | Don't attempt to specify datetime precision unless supportedSean Griffin2015-09-231-1/+1
| | | | | | | | | | | | | | | | | | Specifically, versions of MySQL prior to 5.6 do not support this, which is what's used on Travis by default. The method `mysql_56?` appeared to only ever be used to conditionally apply subsecond precision, so I've generalized it and used it more liberally. This should fix the test failures caused by #20317
* | File encoding is defaulted to utf-8 in Ruby >= 2.1Akira Matsuda2015-09-181-2/+0
| |