diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-07 06:11:56 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-07 06:11:56 +0000 |
commit | 2399a223c35622178ea58db6629cfd26f2230d60 (patch) | |
tree | 5a3c5fc32560643eb042631a3f23f357eb74ca09 /actionpack/test | |
parent | 2bf8f2307e3f13a7b6cf703cdb954cc9a3f5244d (diff) | |
download | rails-2399a223c35622178ea58db6629cfd26f2230d60.tar.gz rails-2399a223c35622178ea58db6629cfd26f2230d60.tar.bz2 rails-2399a223c35622178ea58db6629cfd26f2230d60.zip |
Deprecation! @session and @flash will be removed after 1.2. Use the session and flash methods instead. You'll get printed warnings during tests and logged warnings in dev mode when you access either instance variable directly.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4699 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/deprecated_instance_variables_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/actionpack/test/controller/deprecated_instance_variables_test.rb b/actionpack/test/controller/deprecated_instance_variables_test.rb new file mode 100644 index 0000000000..81e7ba1324 --- /dev/null +++ b/actionpack/test/controller/deprecated_instance_variables_test.rb @@ -0,0 +1,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 |