Permalink
Browse files

Test for becomes() type assignment & persistence

  • Loading branch information...
1 parent 89cc4f1 commit af1d680451254fabe1c90176eeccc53567597980 @avit committed Aug 14, 2012
Showing with 11 additions and 0 deletions.
  1. +11 −0 activerecord/test/cases/base_test.rb
@@ -1788,6 +1788,17 @@ def test_becomes_includes_errors
assert_equal original_errors, client.errors
end
+ def test_becomes_changes_type_attribute
+ topic = topics(:second)
+ reply = topic.becomes(SillyReply)
+ assert reply.type_changed?
+ assert reply.is_a?(SillyReply)
+ assert_equal "SillyReply", reply.type
+ reply.type = "SillyReply"
+ reply.save!
+ assert_equal "SillyReply", Reply.find(reply.id).type
+ end
+
def test_silence_sets_log_level_to_error_in_block
original_logger = ActiveRecord::Base.logger
log = StringIO.new

0 comments on commit af1d680

Please sign in to comment.