aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/integration_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* :scissors:Ryuta Kamizono2017-04-131-1/+0
| | | | [ci skip]
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-2/+2
|
* Fix issue with `cache_key` when the named timestamp column has value nilPrathamesh Sonpatki2016-09-071-0/+6
| | | | | | | - When the named timestamp column is nil, we should just return the cache_key with model name and id similar to the behavior of implicit timestamp columns. - Fixed one of the issue mentioned in https://github.com/rails/rails/issues/26417.
* applies new string literal convention in activerecord/testXavier Noria2016-08-061-25/+25
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* fix to_param to maximize contentRob Biedenharn2016-07-081-2/+28
| | | | | | | | | | | | | | | | | | | | | The documentation states that parameter values longer than 20 characters will be truncated by words, but the example shows that a parameter based on "David Heinemeier Hansson" (with id: 125) becomes "125-david" when "David Heinemeier".length == 16 so why so short? The answer lies in the use of the #truncate option omission: nil which seems to have been intended to mean "nothing", but which actually causes the default string "..." to be used. This causes #truncate to cleave words until the "..." can be added and still remain within the requested size of 20 characters. The better option is omission: '' (which is probably what was originally intended). Furthermore, since the use of #parameterize will remove non-alphanumeric characters, we can maximize the useful content of the output by calling parameterize first and then giving truncate a separator: /-/ rather than a space.
* fixes #21815Maarten Jacobs2015-10-161-5/+13
| | | | | | | | | | | | | | | The default timestamp used for AR is `updated_at` in nanoseconds! (:nsec) This causes issues on any machine that runs an OS that supports nanoseconds timestamps, i.e. not-OS X, where the cache_key of the record persisted in the database (milliseconds precision) is out-of-sync with the cache_key in the ruby VM. This commit adds: A test that shows the issue, it can be found in the separate file `cache_key_test.rb`, because - model couldn't be defined inline - transactional testing needed to be turned off to get it to pass the MySQL tests This seemed cleaner than putting it in an existing testcase file. It adds :usec as a dateformat that calculates datetime in microseconds It sets precision of cache_key to :usec instead of :nsec, as no db supports nsec precision on timestamps
* Fix test failures on MySQLSean Griffin2015-10-021-1/+3
| | | | | There were a few places where I missed a `create` vs `new` before_type_cast check, and the semantics of `reload` became wrong.
* Don't rely on subsecond precision being applied in testsSean Griffin2015-09-231-0/+1
| | | | | | When I originally reviewed the #20317, I believe these changes were present, but it appears that it was later updated so that they were removed. Since Travis hadn't re-run the build, this slipped through.
* Removed magic comments # encoding: utf-8 , since its default from ruby 2.0 ↵Vipul A M2015-02-031-1/+0
| | | | onwards.
* Build fix when running in isolationArun Agrawal2014-11-141-0/+1
| | | | | `Computer` class needs to be require See #17217 for more details
* Fix test for cache_key + touchedCarlos Antonio da Silva2014-01-161-9/+9
| | | | | Ensure the child can actually be touched. The `Bulb` model has no timestamp column, thus trying to touch it would return `nil`.
* set encoding UTF-8 for accepting multibyte characterKuldeep Aggarwal2013-12-191-0/+2
|
* Fix to_param when attribute has multibyte characterrono232013-12-191-0/+6
|
* added one test case and example for ActiveRecord::Base.to_param methodKuldeep Aggarwal2013-11-151-0/+6
|
* Addendum to #12891Javan Makhmali2013-11-141-2/+18
| | | | | | * Fix incorrectly named tests * Restore Object#to_param behavior * Ensure param is derived from a squished and truncated string
* Add AR::Base.to_param for convenient "pretty" URLs derived from a model's ↵Javan Makhmali2013-11-141-0/+18
| | | | attribute or method.
* Respect cache timestamp format when giving timestamps to #cache_keyCarlos Antonio da Silva2013-11-041-2/+2
|
* Extend ActiveRecord::Base#cache_key to take an optional list of timestamp ↵David Heinemeier Hansson2013-11-021-1/+7
| | | | attributes of which the highest will be used.
* prevent global timezone state from leaking out of test cases.Yves Senn2013-10-251-9/+4
|
* make test order independent by resetting timezoneNeeraj Singh2013-07-281-0/+2
|
* Add test for `AR::Base#to_param`Takehiro Adachi2013-05-021-1/+6
| | | | | | | According to the doc of `AR::Base#to_param`( https://github.com/rails/rails/blob/04cda1848cb847c2bdad0bfc12160dc8d554 7775/activerecord/lib/active_record/integration.rb#L18 ), it returns `nil` if the record is not persisted.
* Extract tests code out from AR's base_test.rb to integration_test.rbTakehiro Adachi2013-05-021-0/+82
`AR::Base#to_param` and `AR::Base#cache_key` is defined at active_record/integration.rb, so tests for those methods should be at integration_test.rb