aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/deprecated_instance_variables_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/actionpack/test/template/deprecated_instance_variables_test.rb b/actionpack/test/template/deprecated_instance_variables_test.rb
new file mode 100644
index 0000000000..86fc7d6139
--- /dev/null
+++ b/actionpack/test/template/deprecated_instance_variables_test.rb
@@ -0,0 +1,31 @@
+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 <<-end_eval
+ def old_#{var}; render :inline => '<%= @#{var}.inspect %>' end
+ def new_#{var}; render :inline => '<%= #{var}.inspect %>' end
+ end_eval
+ 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
+ end_eval
+ end
+end