diff options
author | Prathamesh Sonpatki <csonpatki@gmail.com> | 2016-07-16 11:32:05 +0530 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2017-04-26 22:54:55 -0700 |
commit | 8d791b0370a0285fe6ef5346c12e5fd9444b02dc (patch) | |
tree | d483cf57ba914d18bd673f385f0ec147ce351e1c /activerecord | |
parent | e59d1354e8c2983aba64dbf3dd83f03d3845ceb9 (diff) | |
download | rails-8d791b0370a0285fe6ef5346c12e5fd9444b02dc.tar.gz rails-8d791b0370a0285fe6ef5346c12e5fd9444b02dc.tar.bz2 rails-8d791b0370a0285fe6ef5346c12e5fd9444b02dc.zip |
Fix the random failure of `test_create_resets_cached_counters`
- Tried specifying `id` for the `readers` records but it is
interconnected with so many tests that many random tests started
failing.
- So switched to the approach of deleting all readers in the
`create_resets_cached_counters` test.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 3 | ||||
-rw-r--r-- | activerecord/test/fixtures/readers.yml | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb index 1eb10c1dbe..6ba738ed6c 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -456,7 +456,10 @@ class HasManyAssociationsTest < ActiveRecord::TestCase end def test_create_resets_cached_counters + Reader.delete_all + person = Person.create!(first_name: "tenderlove") + post = Post.first assert_equal [], person.readers diff --git a/activerecord/test/fixtures/readers.yml b/activerecord/test/fixtures/readers.yml index af5f888e4b..14b883f041 100644 --- a/activerecord/test/fixtures/readers.yml +++ b/activerecord/test/fixtures/readers.yml @@ -1,9 +1,11 @@ michael_welcome: + id: 1 post_id: 1 - person: michael + person_id: 1 first_post_id: 2 michael_authorless: + id: 2 post_id: 3 - person: michael + person_id: 1 first_post_id: 3 |