diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-09-22 21:35:35 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-22 21:35:35 +0200 |
commit | 638bd19c7fdf4a4c09bfa5b4ada23c6f37724f9b (patch) | |
tree | c27414d94e86b396fe716e031a6fafb0fc8ca575 /activerecord/test/cases/base_test.rb | |
parent | 5795c509a7c0ab9c6d3d707f34526430e58e535c (diff) | |
parent | 5f86451a4c5d0beca5a746c4708be48b13f665be (diff) | |
download | rails-638bd19c7fdf4a4c09bfa5b4ada23c6f37724f9b.tar.gz rails-638bd19c7fdf4a4c09bfa5b4ada23c6f37724f9b.tar.bz2 rails-638bd19c7fdf4a4c09bfa5b4ada23c6f37724f9b.zip |
Merge branch 'patches' into multibyte
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rwxr-xr-x | activerecord/test/cases/base_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index a4fddc2571..d512834237 100755 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -472,6 +472,18 @@ class BasicsTest < ActiveRecord::TestCase assert topic.instance_variable_get("@custom_approved") end + def test_delete + topic = Topic.find(1) + assert_equal topic, topic.delete, 'topic.delete did not return self' + assert topic.frozen?, 'topic not frozen after delete' + assert_raise(ActiveRecord::RecordNotFound) { Topic.find(topic.id) } + end + + def test_delete_doesnt_run_callbacks + Topic.find(1).delete + assert_not_nil Topic.find(2) + end + def test_destroy topic = Topic.find(1) assert_equal topic, topic.destroy, 'topic.destroy did not return self' @@ -820,6 +832,20 @@ class BasicsTest < ActiveRecord::TestCase assert_equal [ Topic.find(1) ], [ Topic.find(2).topic ] & [ Topic.find(1) ] end + def test_delete_new_record + client = Client.new + client.delete + assert client.frozen? + end + + def test_delete_record_with_associations + client = Client.find(3) + client.delete + assert client.frozen? + assert_kind_of Firm, client.firm + assert_raises(ActiveSupport::FrozenObjectError) { client.name = "something else" } + end + def test_destroy_new_record client = Client.new client.destroy |