aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRyuta Kamizono <kamipo@gmail.com>2018-04-21 21:27:50 +0900
committerRyuta Kamizono <kamipo@gmail.com>2018-04-27 22:43:46 +0900
commit19c80718afea8cf8f56ee68fcfbe325d54c02906 (patch)
tree09a62e19ccb1deefdaebf5813c8e882ef50f6488 /activerecord/test/cases
parent0a8fe15ba8fc7c36253996c557a0012f718d7d60 (diff)
downloadrails-19c80718afea8cf8f56ee68fcfbe325d54c02906.tar.gz
rails-19c80718afea8cf8f56ee68fcfbe325d54c02906.tar.bz2
rails-19c80718afea8cf8f56ee68fcfbe325d54c02906.zip
Ensure that `ids_reader` respects dirty target whether target is loaded or not
Currently `ids_reader` doesn't respect dirty target when the target is not loaded yet unlike `collection.size`. I believe the inconsistency is a bug, fixes the `ids_reader` to behave consistently regardless of whether target is loaded or not.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb4
1 files changed, 2 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 feb7390e2c..2e0a7ab1ab 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -989,7 +989,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal 0, post.readers.size
post.readers.reset
post.readers.build
- assert_equal [], post.reader_ids
+ assert_equal [nil], post.reader_ids
assert_equal 1, post.readers.size
end
@@ -999,7 +999,7 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_empty post.readers
post.readers.reset
post.readers.build
- assert_equal [], post.reader_ids
+ assert_equal [nil], post.reader_ids
assert_not_empty post.readers
end