aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_dispatch/routing/mapper.rb2
-rw-r--r--actionpack/test/dispatch/mapper_test.rb7
2 files changed, 8 insertions, 1 deletions
diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb
index 003bc1dc2c..ee4d405ce7 100644
--- a/actionpack/lib/action_dispatch/routing/mapper.rb
+++ b/actionpack/lib/action_dispatch/routing/mapper.rb
@@ -51,7 +51,7 @@ module ActionDispatch
IGNORE_OPTIONS = [:to, :as, :via, :on, :constraints, :defaults, :only, :except, :anchor, :shallow, :shallow_path, :shallow_prefix]
ANCHOR_CHARACTERS_REGEX = %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z}
SHORTHAND_REGEX = %r{^/[\w/]+$}
- WILDCARD_PATH = %r{\*([^/]+)$}
+ WILDCARD_PATH = %r{\*([^/\)]+)\)?$}
def initialize(set, scope, path, options)
@set, @scope = set, scope
diff --git a/actionpack/test/dispatch/mapper_test.rb b/actionpack/test/dispatch/mapper_test.rb
index 81f0efb76e..3316dd03aa 100644
--- a/actionpack/test/dispatch/mapper_test.rb
+++ b/actionpack/test/dispatch/mapper_test.rb
@@ -35,6 +35,13 @@ module ActionDispatch
Mapper.new FakeSet.new
end
+ def test_mapping_requirements
+ options = { :controller => 'foo', :action => 'bar' }
+ m = Mapper::Mapping.new FakeSet.new, {}, '/store/:name(*rest)', options
+ _, _, requirements, _ = m.to_route
+ assert_equal(/.+?/, requirements[:rest])
+ end
+
def test_map_slash
fakeset = FakeSet.new
mapper = Mapper.new fakeset