提交 a957243c 编写于 作者: J Justin Collins

Fix tests for `redirect_to :only_path => true`

上级 5a0eb528
...@@ -73,8 +73,8 @@ class HomeController < ApplicationController ...@@ -73,8 +73,8 @@ class HomeController < ApplicationController
current_user.something.something.build(params[:awesome_user]) current_user.something.something.build(params[:awesome_user])
end end
def test_only_path def test_only_path_wrong
redirect_to params[:user], :only_path => true redirect_to params[:user], :only_path => true #This should still warn
end end
def test_url_for_only_path def test_url_for_only_path
...@@ -92,6 +92,12 @@ class HomeController < ApplicationController ...@@ -92,6 +92,12 @@ class HomeController < ApplicationController
y + 1 + 2 y + 1 + 2
end end
def test_only_path_correct
params.merge! :only_path => true
redirect_to params
end
private private
def filter_it def filter_it
......
...@@ -15,7 +15,7 @@ class Rails3Tests < Test::Unit::TestCase ...@@ -15,7 +15,7 @@ class Rails3Tests < Test::Unit::TestCase
:controller => 1, :controller => 1,
:model => 5, :model => 5,
:template => 23, :template => 23,
:warning => 29 :warning => 30
} }
end end
...@@ -135,11 +135,11 @@ class Rails3Tests < Test::Unit::TestCase ...@@ -135,11 +135,11 @@ class Rails3Tests < Test::Unit::TestCase
:file => /products_controller\.rb/ :file => /products_controller\.rb/
end end
def test_redirect_only_path def test_redirect_only_path_in_wrong_argument
assert_no_warning :type => :warning, assert_warning :type => :warning,
:warning_type => "Redirect", :warning_type => "Redirect",
:line => 78, :line => 77,
:message => /^Possible unprotected redirect near line 78: redirect_to\(params\[/, :message => /^Possible unprotected redirect near line 77: redirect_to\(params\[/,
:confidence => 0, :confidence => 0,
:file => /home_controller\.rb/ :file => /home_controller\.rb/
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册