aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/url_generation_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/dispatch/url_generation_test.rb')
-rw-r--r--actionpack/test/dispatch/url_generation_test.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/url_generation_test.rb b/actionpack/test/dispatch/url_generation_test.rb
new file mode 100644
index 0000000000..18b5b7ee00
--- /dev/null
+++ b/actionpack/test/dispatch/url_generation_test.rb
@@ -0,0 +1,38 @@
+require 'abstract_unit'
+
+module TestUrlGeneration
+ class WithMountPoint < ActionDispatch::IntegrationTest
+ Router = ActionDispatch::Routing::RouteSet.new
+ Router.draw { match "/foo", :to => "my_route_generating#index", :as => :foo }
+
+ class ::MyRouteGeneratingController < ActionController::Base
+ include Router.url_helpers
+ def index
+ render :text => foo_path
+ end
+ end
+
+ include Router.url_helpers
+
+ def _router
+ Router
+ end
+
+ def app
+ Router
+ end
+
+ test "generating URLS normally" do
+ assert_equal "/foo", foo_path
+ end
+
+ test "accepting a :script_name option" do
+ assert_equal "/bar/foo", foo_path(:script_name => "/bar")
+ end
+
+ test "the request's SCRIPT_NAME takes precedence over the router's" do
+ get "/foo", {}, 'SCRIPT_NAME' => "/new"
+ assert_equal "/new/foo", response.body
+ end
+ end
+end \ No newline at end of file