blob: 81e7ba1324ebb5db1bd150f85a6586c746fa4c7f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
require File.dirname(__FILE__) + '/../abstract_unit'
class DeprecatedInstanceVariablesTest < Test::Unit::TestCase
class Target < ActionController::Base
ActionController::Base::DEPRECATED_INSTANCE_VARIABLES.each do |var|
class_eval "def old_#{var}; render :text => @#{var}.inspect end"
class_eval "def new_#{var}; render :text => #{var}.inspect end"
class_eval "def internal_#{var}; render :text => @_#{var}.inspect end"
end
def rescue_action(e) raise e end
end
def setup
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
@controller = Target.new
end
ActionController::Base::DEPRECATED_INSTANCE_VARIABLES.each do |var|
class_eval <<-end_eval, __FILE__, __LINE__
def test_old_#{var}_is_deprecated
assert_deprecated('@#{var}') { get :old_#{var} }
end
def test_new_#{var}_isnt_deprecated
assert_not_deprecated { get :new_#{var} }
end
def test_internal_#{var}_isnt_deprecated
assert_not_deprecated { get :internal_#{var} }
end
end_eval
end
end
|