Skip to content

Commit

Permalink
Test for becomes() type assignment & persistence
Browse files Browse the repository at this point in the history
  • Loading branch information
avit committed Aug 14, 2012
1 parent 89cc4f1 commit af1d680
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions activerecord/test/cases/base_test.rb
Expand Up @@ -1788,6 +1788,17 @@ def test_becomes_includes_errors
assert_equal original_errors, client.errors assert_equal original_errors, client.errors
end 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 def test_silence_sets_log_level_to_error_in_block
original_logger = ActiveRecord::Base.logger original_logger = ActiveRecord::Base.logger
log = StringIO.new log = StringIO.new
Expand Down

0 comments on commit af1d680

Please sign in to comment.