aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@users.noreply.github.com>2019-01-09 15:57:14 -0500
committerGitHub <noreply@github.com>2019-01-09 15:57:14 -0500
commitff807f823b869d3491935a096183ee2bebd58e7b (patch)
tree3a28f0a38c6345ddbf90901f4362d17a20557abc /activerecord
parent9f1a07af0499080c9fd8815705a03a4c7e8fb506 (diff)
parent686f85515f64aa5cffd44a392d9c2ea0b8b0d51f (diff)
downloadrails-ff807f823b869d3491935a096183ee2bebd58e7b.tar.gz
rails-ff807f823b869d3491935a096183ee2bebd58e7b.tar.bz2
rails-ff807f823b869d3491935a096183ee2bebd58e7b.zip
Merge pull request #34900 from gmcgibbon/fix_test_find_only_some_columns
Reset column info on original Topic in serialized attr test
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/serialized_attribute_test.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/activerecord/test/cases/serialized_attribute_test.rb b/activerecord/test/cases/serialized_attribute_test.rb
index f6cd4f85ee..fa136fe8da 100644
--- a/activerecord/test/cases/serialized_attribute_test.rb
+++ b/activerecord/test/cases/serialized_attribute_test.rb
@@ -22,7 +22,7 @@ class SerializedAttributeTest < ActiveRecord::TestCase
end
def test_serialize_does_not_eagerly_load_columns
- Topic.reset_column_information
+ reset_column_information_of(Topic)
assert_no_queries do
Topic.serialize(:content)
end
@@ -377,7 +377,8 @@ class SerializedAttributeTest < ActiveRecord::TestCase
topic.update group: "1"
model.serialize :group, JSON
- model.reset_column_information
+
+ reset_column_information_of(model)
# This isn't strictly necessary for the test, but a little bit of
# knowledge of internals allows us to make failures far more likely.
@@ -397,4 +398,12 @@ class SerializedAttributeTest < ActiveRecord::TestCase
# raw string ("1"), or raise an exception.
assert_equal [1] * threads.size, threads.map(&:value)
end
+
+ private
+
+ def reset_column_information_of(topic_class)
+ topic_class.reset_column_information
+ # reset original topic to undefine attribute methods
+ ::Topic.reset_column_information
+ end
end