aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/prefix_generation_test.rb
diff options
context:
space:
mode:
authorthedarkone <thedarkone2@gmail.com>2011-06-06 14:13:06 +0200
committerthedarkone <thedarkone2@gmail.com>2011-07-25 13:43:02 +0200
commit036f77574d5cd095b9ea78e2fd927c8d7764bd31 (patch)
treece5f8e923f5acee297bfdacd3d6bd271f5c90339 /actionpack/test/dispatch/prefix_generation_test.rb
parent02691d3516e68b2de5545ec7a495024a377f89fc (diff)
downloadrails-036f77574d5cd095b9ea78e2fd927c8d7764bd31.tar.gz
rails-036f77574d5cd095b9ea78e2fd927c8d7764bd31.tar.bz2
rails-036f77574d5cd095b9ea78e2fd927c8d7764bd31.zip
Make polymorphic_url calls go through application helpers again.
This brings back the ability to overwrite/extend url generating methods in application heleprs.
Diffstat (limited to 'actionpack/test/dispatch/prefix_generation_test.rb')
-rw-r--r--actionpack/test/dispatch/prefix_generation_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/prefix_generation_test.rb b/actionpack/test/dispatch/prefix_generation_test.rb
index b28a058250..93eccaecbd 100644
--- a/actionpack/test/dispatch/prefix_generation_test.rb
+++ b/actionpack/test/dispatch/prefix_generation_test.rb
@@ -50,7 +50,9 @@ module TestGenerationPrefix
scope "/:omg", :omg => "awesome" do
mount BlogEngine => "/blog", :as => "blog_engine"
end
+ match "/posts/:id", :to => "outside_engine_generating#post", :as => :post
match "/generate", :to => "outside_engine_generating#index"
+ match "/polymorphic_path_for_app", :to => "outside_engine_generating#polymorphic_path_for_app"
match "/polymorphic_path_for_engine", :to => "outside_engine_generating#polymorphic_path_for_engine"
match "/polymorphic_with_url_for", :to => "outside_engine_generating#polymorphic_with_url_for"
match "/conflicting_url", :to => "outside_engine_generating#conflicting"
@@ -101,6 +103,7 @@ module TestGenerationPrefix
class ::OutsideEngineGeneratingController < ActionController::Base
include BlogEngine.routes.mounted_helpers
+ include RailsApplication.routes.url_helpers
def index
render :text => blog_engine.post_path(:id => 1)
@@ -110,6 +113,10 @@ module TestGenerationPrefix
render :text => blog_engine.polymorphic_path(Post.new)
end
+ def polymorphic_path_for_app
+ render :text => polymorphic_path(Post.new)
+ end
+
def polymorphic_with_url_for
render :text => blog_engine.url_for(Post.new)
end
@@ -201,6 +208,11 @@ module TestGenerationPrefix
assert_equal "/awesome/blog/posts/1", last_response.body
end
+ test "polymorphic_path_for_app" do
+ get "/polymorphic_path_for_app"
+ assert_equal "/posts/1", last_response.body
+ end
+
test "[APP] generating engine's url with url_for(@post)" do
get "/polymorphic_with_url_for"
assert_equal "http://example.org/awesome/blog/posts/1", last_response.body