aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/dispatch/routing_test.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2013-04-03 15:01:01 +0200
committerYves Senn <yves.senn@gmail.com>2013-04-03 15:01:01 +0200
commit33971922b3af559d6583b472d1520bc4d13daccc (patch)
tree900188b545a095d1cdd66ebd3fed09ad0ac02f9c /actionpack/test/dispatch/routing_test.rb
parent37683266d86db2b7c39cb32a1e39e3698f6a93a8 (diff)
downloadrails-33971922b3af559d6583b472d1520bc4d13daccc.tar.gz
rails-33971922b3af559d6583b472d1520bc4d13daccc.tar.bz2
rails-33971922b3af559d6583b472d1520bc4d13daccc.zip
fix regression in Mapper when `format:` was used in a `scope`.
Closes #10071 `#normalize_path!` depends on the options so we need to call `#normalize_options!` first to make sure everything is set correctly.
Diffstat (limited to 'actionpack/test/dispatch/routing_test.rb')
-rw-r--r--actionpack/test/dispatch/routing_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb
index df359ba77d..643c83dc91 100644
--- a/actionpack/test/dispatch/routing_test.rb
+++ b/actionpack/test/dispatch/routing_test.rb
@@ -1102,6 +1102,28 @@ class TestRoutingMapper < ActionDispatch::IntegrationTest
assert_equal 'projects#index', @response.body
end
+ def test_scope_with_format_option
+ draw do
+ get "direct/index", as: :no_format_direct, format: false
+
+ scope format: false do
+ get "scoped/index", as: :no_format_scoped
+ end
+ end
+
+ assert_equal "/direct/index", no_format_direct_path
+ assert_equal "/direct/index?format=html", no_format_direct_path(format: "html")
+
+ assert_equal "/scoped/index", no_format_scoped_path
+ assert_equal "/scoped/index?format=html", no_format_scoped_path(format: "html")
+
+ get '/scoped/index'
+ assert_equal "scoped#index", @response.body
+
+ get '/scoped/index.html'
+ assert_equal "Not Found", @response.body
+ end
+
def test_index
draw do
get '/info' => 'projects#info', :as => 'info'