diff options
author | Petri Avikainen <petri.avikainen@gmail.com> | 2019-02-05 14:13:38 +0200 |
---|---|---|
committer | Petri Avikainen <petri.avikainen@gmail.com> | 2019-02-05 14:13:38 +0200 |
commit | 1315582b374f33becfb325bf339674a0a5e6d141 (patch) | |
tree | 49377c5ca63785760544e6d52c5e85cdf32e07e5 /actionpack/test | |
parent | c94754e2f0bc488907157382ece309baf4ddb1b0 (diff) | |
download | rails-1315582b374f33becfb325bf339674a0a5e6d141.tar.gz rails-1315582b374f33becfb325bf339674a0a5e6d141.tar.bz2 rails-1315582b374f33becfb325bf339674a0a5e6d141.zip |
Restrict matching with word boundary or end of string
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/journey/path/pattern_test.rb | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/actionpack/test/journey/path/pattern_test.rb b/actionpack/test/journey/path/pattern_test.rb index 97d99064f2..fcfaba96b0 100644 --- a/actionpack/test/journey/path/pattern_test.rb +++ b/actionpack/test/journey/path/pattern_test.rb @@ -34,17 +34,17 @@ module ActionDispatch end { - "/:controller(/:action)" => %r{\A/(#{x})(?:/([^/.?]+))?\b}, - "/:controller/foo" => %r{\A/(#{x})/foo\b}, - "/:controller/:action" => %r{\A/(#{x})/([^/.?]+)\b}, - "/:controller" => %r{\A/(#{x})\b}, - "/:controller(/:action(/:id))" => %r{\A/(#{x})(?:/([^/.?]+)(?:/([^/.?]+))?)?\b}, - "/:controller/:action.xml" => %r{\A/(#{x})/([^/.?]+)\.xml\b}, - "/:controller.:format" => %r{\A/(#{x})\.([^/.?]+)\b}, - "/:controller(.:format)" => %r{\A/(#{x})(?:\.([^/.?]+))?\b}, - "/:controller/*foo" => %r{\A/(#{x})/(.+)\b}, - "/:controller/*foo/bar" => %r{\A/(#{x})/(.+)/bar\b}, - "/:foo|*bar" => %r{\A/(?:([^/.?]+)|(.+))\b}, + "/:controller(/:action)" => %r{\A/(#{x})(?:/([^/.?]+))?(?:\b|\Z)}, + "/:controller/foo" => %r{\A/(#{x})/foo(?:\b|\Z)}, + "/:controller/:action" => %r{\A/(#{x})/([^/.?]+)(?:\b|\Z)}, + "/:controller" => %r{\A/(#{x})(?:\b|\Z)}, + "/:controller(/:action(/:id))" => %r{\A/(#{x})(?:/([^/.?]+)(?:/([^/.?]+))?)?(?:\b|\Z)}, + "/:controller/:action.xml" => %r{\A/(#{x})/([^/.?]+)\.xml(?:\b|\Z)}, + "/:controller.:format" => %r{\A/(#{x})\.([^/.?]+)(?:\b|\Z)}, + "/:controller(.:format)" => %r{\A/(#{x})(?:\.([^/.?]+))?(?:\b|\Z)}, + "/:controller/*foo" => %r{\A/(#{x})/(.+)(?:\b|\Z)}, + "/:controller/*foo/bar" => %r{\A/(#{x})/(.+)/bar(?:\b|\Z)}, + "/:foo|*bar" => %r{\A/(?:([^/.?]+)|(.+))(?:\b|\Z)}, }.each do |path, expected| define_method(:"test_to_non_anchored_regexp_#{Regexp.escape(path)}") do path = Pattern.build( |