mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
make sure we are only doing sanity checking against regular expressions
This commit is contained in:
@@ -114,7 +114,7 @@ module ActionDispatch
|
||||
requirements.reverse_merge!(@scope[:constraints]) if @scope[:constraints]
|
||||
@options.each { |k, v| requirements[k] = v if v.is_a?(Regexp) }
|
||||
|
||||
requirements.each do |_, requirement|
|
||||
requirements.values.grep(Regexp).each do |requirement|
|
||||
if requirement.source =~ %r{\A(\\A|\^)|(\\Z|\\z|\$)\Z}
|
||||
raise ArgumentError, "Regexp anchor characters are not allowed in routing requirements: #{requirement.inspect}"
|
||||
end
|
||||
|
||||
@@ -171,6 +171,14 @@ class ActionPackAssertionsControllerTest < ActionController::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
def test_string_constraint
|
||||
with_routing do |set|
|
||||
set.draw do |map|
|
||||
match "photos", :to => 'action_pack_assertions#nothing', :constraints => {:subdomain => "admin"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_assert_redirect_to_named_route_failure
|
||||
with_routing do |set|
|
||||
set.draw do
|
||||
|
||||
Reference in New Issue
Block a user