aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2014-12-13 19:03:30 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2014-12-13 19:03:30 -0200
commitef99d4cd3ecc58a8c1484740b2fb5447dbda23ab (patch)
tree7c706dd5785c4101614a29fb7808df1294551079 /actionpack/test
parent390f09efa3850d735bb9426a4a41a81f8ea400d2 (diff)
parenta842c5c12d4c1091c4e065cbdbc3adb58ce55bc9 (diff)
downloadrails-ef99d4cd3ecc58a8c1484740b2fb5447dbda23ab.tar.gz
rails-ef99d4cd3ecc58a8c1484740b2fb5447dbda23ab.tar.bz2
rails-ef99d4cd3ecc58a8c1484740b2fb5447dbda23ab.zip
Merge pull request #18022 from agrobbin/url-helpers-optional-scopes
Allow URL helpers to work with optional scopes
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/dispatch/routing/route_set_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/routing/route_set_test.rb b/actionpack/test/dispatch/routing/route_set_test.rb
index 5a39119446..8bdb5733dd 100644
--- a/actionpack/test/dispatch/routing/route_set_test.rb
+++ b/actionpack/test/dispatch/routing/route_set_test.rb
@@ -160,6 +160,18 @@ module ActionDispatch
assert_equal '/foo/1/bar/2', url_helpers.foo_bar_path(2, foo_id: 1)
end
+ test "having an optional scope with resources" do
+ draw do
+ scope "(/:foo)" do
+ resources :users
+ end
+ end
+
+ assert_equal '/users/1', url_helpers.user_path(1)
+ assert_equal '/users/1', url_helpers.user_path(1, foo: nil)
+ assert_equal '/a/users/1', url_helpers.user_path(1, foo: 'a')
+ end
+
test "stringified controller and action keys are properly symbolized" do
draw do
root 'foo#bar'