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

Add test for helper assigning ivar called twice

If a method only assigns ivars, then there is no
reason to process method twice. It will be cached,
but we want to test case where we need the ivar
values from a cached method that does not depend
on environment.
上级 f3cf56cb
......@@ -131,6 +131,10 @@ class UsersController < ApplicationController
@other_thing = simple_helper_with_args(params[:x])
end
def test_assign_twice
assign_ivar
end
private
def simple_helper
......
......@@ -2,6 +2,7 @@ Rails31::Application.routes.draw do
resources :users
match 'users/test_simple_helper' => "users#test_simple_helper"
match 'users/test_less_simple_helpers' => "users#test_less_simple_helpers"
match 'users/test_less_simple_helpers' => "users#test_assign_twice"
resources :users do
get 'mixin_action'
......
......@@ -608,6 +608,15 @@ class Rails31Tests < Test::Unit::TestCase
:file => /test_less_simple_helpers\.html\.erb/
end
def test_xss_helper_assign_ivar_twice
assert_warning :type => :template,
:warning_type => "Cross Site Scripting",
:line => 1,
:message => /^Unescaped\ parameter\ value/,
:confidence => 0,
:file => /test_assign_twice\.html\.erb/
end
def test_xss_helper_model_return
assert_warning :type => :template,
:warning_type => "Cross Site Scripting",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册