diff options
Diffstat (limited to 'activerecord/test/cases/persistence_test.rb')
-rw-r--r-- | activerecord/test/cases/persistence_test.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index bc5ccd0fe9..7f5d0d66d3 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -251,7 +251,7 @@ class PersistenceTest < ActiveRecord::TestCase def test_create_columns_not_equal_attributes topic = Topic.allocate.init_with( - 'attributes' => { + 'raw_attributes' => { 'title' => 'Another New Topic', 'does_not_exist' => 'test' } @@ -302,7 +302,7 @@ class PersistenceTest < ActiveRecord::TestCase topic_reloaded = Topic.allocate topic_reloaded.init_with( - 'attributes' => topic.attributes.merge('does_not_exist' => 'test') + 'raw_attributes' => topic.attributes.merge('does_not_exist' => 'test') ) topic_reloaded.title = 'A New Topic' assert_nothing_raised { topic_reloaded.save } @@ -333,6 +333,15 @@ class PersistenceTest < ActiveRecord::TestCase assert_equal "Reply", topic.type end + def test_update_sti_subclass_type + assert_instance_of Topic, topics(:first) + + reply = topics(:first).becomes!(Reply) + assert_instance_of Reply, reply + reply.save! + assert_instance_of Reply, Reply.find(reply.id) + end + def test_update_after_create klass = Class.new(Topic) do def self.name; 'Topic'; end |