diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-05-14 17:30:35 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-05-14 17:30:35 +0000 |
commit | 6e7b593992f8f6f8e783b87e7ab9d1d5a97063f7 (patch) | |
tree | 8de722a5e02bd4e0e7bcfc10bc3a677d1744b9f4 /actionpack/test/controller | |
parent | 50253edec97429ea92621bce6578cdedfcc19b62 (diff) | |
download | rails-6e7b593992f8f6f8e783b87e7ab9d1d5a97063f7.tar.gz rails-6e7b593992f8f6f8e783b87e7ab9d1d5a97063f7.tar.bz2 rails-6e7b593992f8f6f8e783b87e7ab9d1d5a97063f7.zip |
Added record identifications to FormHelper#form_for and PrototypeHelper#remote_form_for [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6731 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r-- | actionpack/test/controller/record_identifier_test.rb | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/actionpack/test/controller/record_identifier_test.rb b/actionpack/test/controller/record_identifier_test.rb index d805a4a385..86d196cfd5 100644 --- a/actionpack/test/controller/record_identifier_test.rb +++ b/actionpack/test/controller/record_identifier_test.rb @@ -1,23 +1,24 @@ require File.dirname(__FILE__) + '/../abstract_unit' -class Post +class Comment attr_reader :id def save; @id = 1 end def new_record?; @id.nil? end def name - @id.nil? ? 'new post' : "post ##{@id}" + @id.nil? ? 'new comment' : "comment ##{@id}" end - class Nested < Post; end end +class Comment::Nested < Comment; end + class Test::Unit::TestCase protected - def posts_url - 'http://www.example.com/posts' + def comments_url + 'http://www.example.com/comments' end - def post_url(post) - "http://www.example.com/posts/#{post.id}" + def comment_url(comment) + "http://www.example.com/comments/#{comment.id}" end end @@ -26,10 +27,10 @@ class RecordIdentifierTest < Test::Unit::TestCase include ActionController::RecordIdentifier def setup - @klass = Post + @klass = Comment @record = @klass.new - @singular = 'post' - @plural = 'posts' + @singular = 'comment' + @plural = 'comments' end def test_dom_id_with_new_record @@ -53,7 +54,7 @@ class RecordIdentifierTest < Test::Unit::TestCase def test_partial_path expected = "#{@plural}/#{@singular}" assert_equal expected, partial_path(@record) - assert_equal expected, partial_path(Post) + assert_equal expected, partial_path(Comment) end def test_dom_class @@ -88,15 +89,15 @@ end class NestedRecordIdentifierTest < RecordIdentifierTest def setup - @klass = Post::Nested + @klass = Comment::Nested @record = @klass.new - @singular = 'post_nested' - @plural = 'post_nesteds' + @singular = 'comment_nested' + @plural = 'comment_nesteds' end def test_partial_path - expected = "post/nesteds/nested" + expected = "comment/nesteds/nested" assert_equal expected, partial_path(@record) - assert_equal expected, partial_path(Post::Nested) + assert_equal expected, partial_path(Comment::Nested) end end
\ No newline at end of file |