Changeset 8880
- Timestamp:
- 02/16/08 03:08:05 (7 months ago)
- Files:
-
- trunk/actionpack/Rakefile (modified) (1 diff)
- trunk/actionpack/test/controller/polymorphic_routes_test.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/Rakefile
r8491 r8880 27 27 Rake::TestTask.new(:test_action_pack) { |t| 28 28 t.libs << "test" 29 # make sure we include the controller tests (c*) firstas on some systems29 # make sure we include the tests in alphabetical order as on some systems 30 30 # this will not happen automatically and the tests (as a whole) will error 31 t.test_files=Dir.glob( "test/ c*/**/*_test.rb" ) + Dir.glob( "test/[ft]*/*_test.rb" )31 t.test_files=Dir.glob( "test/[cft]*/**/*_test.rb" ).sort 32 32 # t.pattern = 'test/*/*_test.rb' 33 33 t.verbose = true trunk/actionpack/test/controller/polymorphic_routes_test.rb
r8741 r8880 11 11 end 12 12 13 class Comment< Article13 class Response < Article 14 14 def post_id; 1 end 15 15 end 16 16 17 17 class Tag < Article 18 def comment_id; 1 end18 def response_id; 1 end 19 19 end 20 20 21 21 # TODO: test nested models 22 class Comment::Nested < Comment; end22 class Response::Nested < Response; end 23 23 24 24 uses_mocha 'polymorphic URL helpers' do … … 29 29 def setup 30 30 @article = Article.new 31 @ comment = Comment.new31 @response = Response.new 32 32 end 33 33 … … 74 74 75 75 def test_with_nested 76 @ comment.save77 expects(:article_ comment_url).with(@article, @comment)78 polymorphic_url([@article, @ comment])76 @response.save 77 expects(:article_response_url).with(@article, @response) 78 polymorphic_url([@article, @response]) 79 79 end 80 80 81 81 def test_with_nested_unsaved 82 expects(:article_ comments_url).with(@article)83 polymorphic_url([@article, @ comment])82 expects(:article_responses_url).with(@article) 83 polymorphic_url([@article, @response]) 84 84 end 85 85 … … 98 98 expects(:admin_article_url).with(@article) 99 99 polymorphic_url([:admin, @article]) 100 expects(:admin_article_ comments_url).with(@article)101 polymorphic_url([:admin, @article, @ comment])100 expects(:admin_article_responses_url).with(@article) 101 polymorphic_url([:admin, @article, @response]) 102 102 end 103 103 104 104 def test_nested_with_array_and_namespace 105 @ comment.save106 expects(:admin_article_ comment_url).with(@article, @comment)107 polymorphic_url([:admin, @article, @ comment])105 @response.save 106 expects(:admin_article_response_url).with(@article, @response) 107 polymorphic_url([:admin, @article, @response]) 108 108 109 109 # a ridiculously long named route tests correct ordering of namespaces and nesting: 110 110 @tag = Tag.new 111 111 @tag.save 112 expects(:site_admin_article_ comment_tag_url).with(@article, @comment, @tag)113 polymorphic_url([:site, :admin, @article, @ comment, @tag])112 expects(:site_admin_article_response_tag_url).with(@article, @response, @tag) 113 polymorphic_url([:site, :admin, @article, @response, @tag]) 114 114 end 115 115