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

Fix/add dynamic render path tests

上级 b64fbda8
......@@ -73,6 +73,10 @@ class HomeController < ApplicationController
User.humans.alive.find(:all, :conditions => "age > #{params[:age]}")
end
def test_another_dynamic_render
render :action => params[:action]
end
private
def filter_it
......
Should not raise a warning:
<%= render :partial => (params[:awesome] ? 'awesome' : 'not_awesome') %>
Also should not raise a warning:
<%= render :partial => User.find(params[:user][:id]) %>
Should raise a warning:
<%= render :file => "/tmp/#{params[:file]}" %>
......@@ -11,14 +11,14 @@ class Rails2Tests < Test::Unit::TestCase
@expected ||= {
:controller => 1,
:model => 2,
:template => 24,
:warning => 22 }
:template => 25,
:warning => 23 }
else
@expected ||= {
:controller => 1,
:model => 2,
:template => 24,
:warning => 23 }
:template => 25,
:warning => 24 }
end
end
......@@ -95,7 +95,16 @@ class Rails2Tests < Test::Unit::TestCase
assert_warning :type => :warning,
:warning_type => "Dynamic Render Path",
:line => 60,
:message => /^Render path is dynamic/,
:message => /^Render path contains parameter value near line 60: render/,
:confidence => 1,
:file => /home_controller\.rb/
end
def test_dynamic_render_path_high_confidence
assert_warning :type => :warning,
:warning_type => "Dynamic Render Path",
:line => 78,
:message => /^Render path contains parameter value near line 78: render/,
:confidence => 0,
:file => /home_controller\.rb/
end
......
......@@ -117,8 +117,8 @@ class Rails3Tests < Test::Unit::TestCase
assert_warning :type => :warning,
:warning_type => "Dynamic Render Path",
:line => 64,
:message => /^Render path is dynamic near line 64: ren/,
:confidence => 0,
:message => /^Render path contains parameter value near line 64: render/,
:confidence => 1,
:file => /home_controller\.rb/
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册