Skip to content

Commit

Permalink
Ensure that url_helpers included after application's ones have higher…
Browse files Browse the repository at this point in the history
… priority
  • Loading branch information
drogus committed Jul 25, 2010
1 parent f5f9d39 commit a75534d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions actionpack/test/dispatch/prefix_generation_test.rb
Expand Up @@ -14,6 +14,7 @@ def self.routes
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
Expand All @@ -37,6 +38,7 @@ def self.routes
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

Expand Down Expand Up @@ -90,6 +92,10 @@ def url_to_application
def polymorphic_path_for_engine
render :text => polymorphic_path(Post.new)
end

def conflicting
render :text => "engine"
end
end

class ::OutsideEngineGeneratingController < ActionController::Base
Expand All @@ -106,6 +112,10 @@ def polymorphic_path_for_engine
def polymorphic_with_url_for
render :text => blog_engine.url_for(Post.new)
end

def conflicting
render :text => "application"
end
end

class EngineObject
Expand Down Expand Up @@ -162,6 +172,11 @@ def setup
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"
Expand Down

0 comments on commit a75534d

Please sign in to comment.