aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/base_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-08-01 07:33:17 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-08-01 07:33:17 +0000
commit4f017bb1b02089846fc26c873599a1026b674be5 (patch)
tree75aea9b7237e3065ef5116ae15f517de7f6079e2 /activerecord/test/base_test.rb
parent9ee5d54e4db5d8448d643fbeece6d42cc7179c7a (diff)
downloadrails-4f017bb1b02089846fc26c873599a1026b674be5.tar.gz
rails-4f017bb1b02089846fc26c873599a1026b674be5.tar.bz2
rails-4f017bb1b02089846fc26c873599a1026b674be5.zip
more concise destroy test
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4646 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/base_test.rb')
-rwxr-xr-xactiverecord/test/base_test.rb18
1 files changed, 5 insertions, 13 deletions
diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb
index a2652b04b6..93415911f9 100755
--- a/activerecord/test/base_test.rb
+++ b/activerecord/test/base_test.rb
@@ -323,22 +323,14 @@ class BasicsTest < Test::Unit::TestCase
assert_equal 9900, Topic.find(2).written_on.usec
end
end
-
+
def test_destroy
- topic = Topic.new
- topic.title = "Yet Another New Topic"
- topic.written_on = "2003-12-12 23:23:00"
- topic.save
- topic.destroy
+ topic = Topic.find(1)
+ assert_equal topic, topic.destroy, 'topic.destroy did not return self'
+ assert topic.frozen?, 'topic not frozen after destroy'
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