提交 7c32b02b 编写于 作者: J Justin

Merge pull request #379 from presidentbeef/avoid_failing_on_variable_controller_names

Don't abort route processing on variable controller names
......@@ -255,13 +255,16 @@ class Brakeman::Rails3RoutesProcessor < Brakeman::BaseProcessor
end
def process_controller_block exp
self.current_controller = exp.block_call.first_arg.value
if string? exp or symbol? exp
self.current_controller = exp.block_call.first_arg.value
in_controller_block do
process exp[-1] if exp[-1]
in_controller_block do
process exp[-1] if exp[-1]
end
@current_controller = nil
end
@current_controller = nil
exp
end
......
......@@ -39,6 +39,10 @@ Rails3::Application.routes.draw do
get "home/test_dynamic_render"
controller "a#{controller_name}" do
get "some_route"
end
# The priority is based upon order of creation:
# first created -> highest priority.
......
......@@ -713,7 +713,7 @@ class Rails3Tests < Test::Unit::TestCase
def test_default_routes
assert_warning :warning_type => "Default Routes",
:line => 97,
:line => 101,
:message => /All public methods in controllers are available as actions/,
:file => /routes\.rb/
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册