提交 5c0d1a94 编写于 作者: J Justin Collins

Test for redirect_to url_for(:only_path => false)

Again, the check for this already exists, just need a test for it
上级 3f9a060e
......@@ -77,6 +77,12 @@ class HomeController < ApplicationController
redirect_to params[:user], :only_path => true
end
def test_url_for_only_path
url = params
url[:only_path] = false
redirect_to url_for(url)
end
private
def filter_it
......
......@@ -15,7 +15,7 @@ class Rails3Tests < Test::Unit::TestCase
:controller => 1,
:model => 5,
:template => 22,
:warning => 23
:warning => 24
}
end
......@@ -131,6 +131,15 @@ class Rails3Tests < Test::Unit::TestCase
:file => /home_controller\.rb/
end
def test_redirect_url_for_not_only_path
assert_warning :type => :warning,
:warning_type => "Redirect",
:line => 84,
:message => /^Possible unprotected redirect near line 84: redirect_to\(url_for/,
:confidence => 0,
:file => /home_controller\.rb/
end
def test_render_path
assert_warning :type => :warning,
:warning_type => "Dynamic Render Path",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册