aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/activerecord
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2009-08-01 16:47:44 +0200
committerJosé Valim <jose.valim@gmail.com>2009-08-07 17:16:16 +0200
commit7034272354ad41dd4d1c90138a79e7f14ebc2bed (patch)
tree51c091d7ff973bbeb1aa2bd7417d0da3a9ed71ba /actionpack/test/activerecord
parentf59984cc81bd1a64a53a2480a9b4e05fe7357d7c (diff)
downloadrails-7034272354ad41dd4d1c90138a79e7f14ebc2bed.tar.gz
rails-7034272354ad41dd4d1c90138a79e7f14ebc2bed.tar.bz2
rails-7034272354ad41dd4d1c90138a79e7f14ebc2bed.zip
Add destroyed? to ActiveRecord, include tests for polymorphic urls for destroyed objects and refactor mime responds tests and documentation.
Diffstat (limited to 'actionpack/test/activerecord')
-rw-r--r--actionpack/test/activerecord/polymorphic_routes_test.rb24
1 files changed, 23 insertions, 1 deletions
diff --git a/actionpack/test/activerecord/polymorphic_routes_test.rb b/actionpack/test/activerecord/polymorphic_routes_test.rb
index 2036d1eeb5..f001b0dab8 100644
--- a/actionpack/test/activerecord/polymorphic_routes_test.rb
+++ b/actionpack/test/activerecord/polymorphic_routes_test.rb
@@ -52,6 +52,13 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
end
+ def test_with_destroyed_record
+ with_test_routes do
+ @project.destroy
+ assert_equal "http://example.com/projects", polymorphic_url(@project)
+ end
+ end
+
def test_with_record_and_action
with_test_routes do
assert_equal "http://example.com/projects/new", polymorphic_url(@project, :action => 'new')
@@ -129,6 +136,14 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
end
+ def test_with_nested_destroyed
+ with_test_routes do
+ @project.save
+ @task.destroy
+ assert_equal "http://example.com/projects/#{@project.id}/tasks", polymorphic_url([@project, @task])
+ end
+ end
+
def test_new_with_array_and_namespace
with_admin_test_routes do
assert_equal "http://example.com/admin/projects/new", polymorphic_url([:admin, @project], :action => 'new')
@@ -257,6 +272,13 @@ class PolymorphicRoutesTest < ActionController::TestCase
assert_equal "http://example.com/taxes", polymorphic_url(@tax)
end
end
+
+ def test_with_irregular_plural_destroyed_record
+ with_test_routes do
+ @tax.destroy
+ assert_equal "http://example.com/taxes", polymorphic_url(@tax)
+ end
+ end
def test_with_irregular_plural_record_and_action
with_test_routes do
@@ -395,4 +417,4 @@ class PolymorphicRoutesTest < ActionController::TestCase
end
end
-end \ No newline at end of file
+end