aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorPiotr Sarnacki <drogus@gmail.com>2010-07-19 13:32:34 +0200
committerPiotr Sarnacki <drogus@gmail.com>2010-09-03 22:59:07 +0200
commit1e6612ef80b019e602231e6833c934817cccb858 (patch)
treea80cbea19de4a2427e082e6ea8196e6ff4d81e75 /actionpack/test
parent6c95e0f879aafa5921cd7898d5951b9a926d3c9a (diff)
downloadrails-1e6612ef80b019e602231e6833c934817cccb858.tar.gz
rails-1e6612ef80b019e602231e6833c934817cccb858.tar.bz2
rails-1e6612ef80b019e602231e6833c934817cccb858.zip
Ensure that url_helpers included after application's ones have higher priority
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/prefix_generation_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/prefix_generation_test.rb b/actionpack/test/dispatch/prefix_generation_test.rb
index 7fe11447b8..3b47a1b72d 100644
--- a/actionpack/test/dispatch/prefix_generation_test.rb
+++ b/actionpack/test/dispatch/prefix_generation_test.rb
@@ -14,6 +14,7 @@ module TestGenerationPrefix
match "/posts", :to => "inside_engine_generating#index", :as => :posts
match "/url_to_application", :to => "inside_engine_generating#url_to_application"
match "/polymorphic_path_for_engine", :to => "inside_engine_generating#polymorphic_path_for_engine"
+ match "/conflicting_url", :to => "inside_engine_generating#conflicting"
end
routes
@@ -37,6 +38,7 @@ module TestGenerationPrefix
match "/generate", :to => "outside_engine_generating#index"
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"
root :to => "outside_engine_generating#index"
end
@@ -90,6 +92,10 @@ module TestGenerationPrefix
def polymorphic_path_for_engine
render :text => polymorphic_path(Post.new)
end
+
+ def conflicting
+ render :text => "engine"
+ end
end
class ::OutsideEngineGeneratingController < ActionController::Base
@@ -106,6 +112,10 @@ module TestGenerationPrefix
def polymorphic_with_url_for
render :text => blog_engine.url_for(Post.new)
end
+
+ def conflicting
+ render :text => "application"
+ end
end
class EngineObject
@@ -162,6 +172,11 @@ module TestGenerationPrefix
assert_equal "/pure-awesomeness/blog/posts/1", last_response.body
end
+ test "[ENGINE] url_helpers from engine have higher priotity than application's url_helpers" do
+ get "/awesome/blog/conflicting_url"
+ assert_equal "engine", last_response.body
+ end
+
# Inside Application
test "[APP] generating engine's route includes prefix" do
get "/generate"