git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2011 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck
2005-08-14 08:58:53 +00:00
parent 73594d88f3
commit b1a4f91a58
2 changed files with 7 additions and 1 deletions

View File

@@ -1187,7 +1187,7 @@ module ActiveRecord #:nodoc:
# Just freeze the attributes hash, such that associations are still accessible even on destroyed records.
def freeze
@attributes.freeze
@attributes.freeze; self
end
def frozen?

View File

@@ -223,6 +223,12 @@ class BasicsTest < Test::Unit::TestCase
assert_raise(ActiveRecord::RecordNotFound) { Topic.find(topic.id) }
end
def test_destroy_returns_self
topic = Topic.new("title" => "Yet Another Title")
assert topic.save
assert_equal topic, topic.destroy, "destroy did not return destroyed object"
end
def test_record_not_found_exception
assert_raises(ActiveRecord::RecordNotFound) { topicReloaded = Topic.find(99999) }
end