diff options
author | Franck Verrot <franck@verrot.fr> | 2010-11-12 01:37:12 +0800 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-11-12 02:17:34 +0800 |
commit | de2933e1a062f0752512eb0ec60f7217f4890f8c (patch) | |
tree | eb5a099fb7665a7828c132de4f1c61b43971a636 /activerecord/test/cases | |
parent | 296e5c38f1b501d39c247f5b7daccedded4e497b (diff) | |
download | rails-de2933e1a062f0752512eb0ec60f7217f4890f8c.tar.gz rails-de2933e1a062f0752512eb0ec60f7217f4890f8c.tar.bz2 rails-de2933e1a062f0752512eb0ec60f7217f4890f8c.zip |
STI type is now updated when calling AR::Base.becomes on subclasses [#5953 state:resolved]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index ffe6fb95b8..07262f56be 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -241,6 +241,15 @@ class PersistencesTest < ActiveRecord::TestCase assert_nothing_raised { minimalistic.save } end + def test_update_sti_type + assert_instance_of Reply, topics(:second) + + topic = topics(:second).becomes(Topic) + assert_instance_of Topic, topic + topic.save! + assert_instance_of Topic, Topic.find(topic.id) + end + def test_delete topic = Topic.find(1) assert_equal topic, topic.delete, 'topic.delete did not return self' |