Browse files

Deprecation: test deprecated instance vars in partials.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4824 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 7b34d0f commit 96c6ca369a302d25c721f0cf2c9d28b0c51e2a69 @jeremy jeremy committed Aug 26, 2006
View
4 actionpack/CHANGELOG
@@ -1,6 +1,8 @@
*SVN*
-* Changed the POST parameter processing to use the new QueryStringParser [DHH]
+* Deprecation: test deprecated instance vars in partials. [Jeremy Kemper]
+
+* Changed the POST parameter processing to use the new QueryStringParser and make the result a indifferent hash [DHH]
* Add UrlWriter to allow writing urls from Mailers and scripts. [Nicholas Seckar]
View
2 actionpack/test/controller/deprecated_instance_variables_test.rb
@@ -1,6 +1,6 @@
require File.dirname(__FILE__) + '/../abstract_unit'
-class DeprecatedInstanceVariablesTest < Test::Unit::TestCase
+class DeprecatedControllerInstanceVariablesTest < Test::Unit::TestCase
class Target < ActionController::Base
def initialize(run = nil)
instance_eval(run) if run
View
1 actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml
@@ -0,0 +1 @@
+<%= @flash[:test] %>
View
1 actionpack/test/fixtures/deprecated_instance_variables/_flash_method.rhtml
@@ -0,0 +1 @@
+<%= flash[:test] %>
View
1 actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml
@@ -0,0 +1 @@
+<%= @params[:test] %>
View
1 actionpack/test/fixtures/deprecated_instance_variables/_params_method.rhtml
@@ -0,0 +1 @@
+<%= params[:test] %>
View
1 actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml
@@ -0,0 +1 @@
+<%= @session[:test] %>
View
1 actionpack/test/fixtures/deprecated_instance_variables/_session_method.rhtml
@@ -0,0 +1 @@
+<%= session[:test] %>
View
26 actionpack/test/template/deprecated_instance_variables_test.rb
@@ -1,11 +1,17 @@
require File.dirname(__FILE__) + '/../abstract_unit'
-class DeprecatedInstanceVariablesTest < Test::Unit::TestCase
- class Target < ActionController::Base
+class DeprecatedViewInstanceVariablesTest < Test::Unit::TestCase
+ class DeprecatedInstanceVariablesController < ActionController::Base
+ self.template_root = "#{File.dirname(__FILE__)}/../fixtures/"
+
+ def self.controller_path; 'deprecated_instance_variables' end
+
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
+ def old_#{var}_inline; render :inline => '<%= @#{var}.inspect %>' end
+ def new_#{var}_inline; render :inline => '<%= #{var}.inspect %>' end
+ def old_#{var}_partial; render :partial => '#{var}_ivar' end
+ def new_#{var}_partial; render :partial => '#{var}_method' end
end_eval
end
@@ -15,16 +21,22 @@ def rescue_action(e) raise e end
def setup
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
- @controller = Target.new
+ @controller = DeprecatedInstanceVariablesController.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} }
+ assert_deprecated('@#{var}') { get :old_#{var}_inline }
end
def test_new_#{var}_isnt_deprecated
- assert_not_deprecated { get :new_#{var} }
+ assert_not_deprecated { get :new_#{var}_inline }
+ end
+ def test_old_#{var}_partial_is_deprecated
+ assert_deprecated('@#{var}') { get :old_#{var}_partial }
+ end
+ def test_new_#{var}_partial_isnt_deprecated
+ assert_not_deprecated { get :new_#{var}_partial }
end
end_eval
end

0 comments on commit 96c6ca3

Please sign in to comment.