diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-07 21:58:31 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-07 21:58:31 +0000 |
commit | c3cdd3b6595ad59129d7652f6f3274f26509a4dc (patch) | |
tree | 399bbb4e1227bad6e18ea6f543e075ec09a1feb0 /actionpack/test | |
parent | c0657a9084825f7ca7b0277e5f07a7ae26b8a126 (diff) | |
download | rails-c3cdd3b6595ad59129d7652f6f3274f26509a4dc.tar.gz rails-c3cdd3b6595ad59129d7652f6f3274f26509a4dc.tar.bz2 rails-c3cdd3b6595ad59129d7652f6f3274f26509a4dc.zip |
Deprecation: check whether instance variables have been monkeyed with before assigning them to deprecation proxies. Raises a RuntimeError if so.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4717 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/controller/deprecated_instance_variables_test.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/actionpack/test/controller/deprecated_instance_variables_test.rb b/actionpack/test/controller/deprecated_instance_variables_test.rb index 81e7ba1324..edfd8b7d02 100644 --- a/actionpack/test/controller/deprecated_instance_variables_test.rb +++ b/actionpack/test/controller/deprecated_instance_variables_test.rb @@ -2,6 +2,15 @@ require File.dirname(__FILE__) + '/../abstract_unit' class DeprecatedInstanceVariablesTest < Test::Unit::TestCase class Target < ActionController::Base + def initialize(run = nil) + instance_eval(run) if run + super() + end + + def noop + render :nothing => true + end + 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" @@ -28,6 +37,12 @@ class DeprecatedInstanceVariablesTest < Test::Unit::TestCase def test_internal_#{var}_isnt_deprecated assert_not_deprecated { get :internal_#{var} } end + def test_#{var}_raises_if_already_set + assert_raise(RuntimeError) do + @controller = Target.new '@#{var} = Object.new' + get :noop + end + end end_eval end end |