aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorChris Salzberg <chris@dejimata.com>2017-12-15 23:37:21 +0900
committerChris Salzberg <chris@dejimata.com>2017-12-17 11:58:26 +0900
commit4aee5fcbfbb1d9eff01c9a2016904ae9fe93046d (patch)
tree259788b5a67246bc469a5f9b31afd34c0571eea7 /activerecord
parent7b1dfac29146ddda82d1ee226cdb8ef281013502 (diff)
downloadrails-4aee5fcbfbb1d9eff01c9a2016904ae9fe93046d.tar.gz
rails-4aee5fcbfbb1d9eff01c9a2016904ae9fe93046d.tar.bz2
rails-4aee5fcbfbb1d9eff01c9a2016904ae9fe93046d.zip
Add failing test
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/persistence_test.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb
index c0b9a3ef76..068d80eb3b 100644
--- a/activerecord/test/cases/persistence_test.rb
+++ b/activerecord/test/cases/persistence_test.rb
@@ -1106,13 +1106,18 @@ class PersistenceTest < ActiveRecord::TestCase
end
def test_reset_column_information_resets_children
- child = Class.new(Topic)
- child.new # force schema to load
+ child_class = Class.new(Topic)
+ child_class.new # force schema to load
ActiveRecord::Base.connection.add_column(:topics, :foo, :string)
Topic.reset_column_information
- assert_equal "bar", child.new(foo: :bar).foo
+ # this should redefine attribute methods
+ child_class.new
+
+ assert child_class.instance_methods.include?(:foo)
+ assert child_class.instance_methods.include?(:foo_changed?)
+ assert_equal "bar", child_class.new(foo: :bar).foo
ensure
ActiveRecord::Base.connection.remove_column(:topics, :foo)
Topic.reset_column_information