diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-26 05:58:16 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-08-26 05:58:16 +0000 |
commit | 96c6ca369a302d25c721f0cf2c9d28b0c51e2a69 (patch) | |
tree | 49459ffc8d55f3594071842b2632f1f6feaac1bf /actionpack | |
parent | 7b34d0f8c503789f00b1d312a0f24a4cd5c063c5 (diff) | |
download | rails-96c6ca369a302d25c721f0cf2c9d28b0c51e2a69.tar.gz rails-96c6ca369a302d25c721f0cf2c9d28b0c51e2a69.tar.bz2 rails-96c6ca369a302d25c721f0cf2c9d28b0c51e2a69.zip |
Deprecation: test deprecated instance vars in partials.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4824 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
9 files changed, 29 insertions, 9 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index a5c1a3b01e..a103a9fede 100644 --- a/actionpack/CHANGELOG +++ b/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] diff --git a/actionpack/test/controller/deprecated_instance_variables_test.rb b/actionpack/test/controller/deprecated_instance_variables_test.rb index edfd8b7d02..f8b8f4352b 100644 --- a/actionpack/test/controller/deprecated_instance_variables_test.rb +++ b/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 diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml new file mode 100644 index 0000000000..4b4782b287 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_flash_ivar.rhtml @@ -0,0 +1 @@ +<%= @flash[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_flash_method.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_flash_method.rhtml new file mode 100644 index 0000000000..f7f9d0913a --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_flash_method.rhtml @@ -0,0 +1 @@ +<%= flash[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml new file mode 100644 index 0000000000..1eea68757f --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_params_ivar.rhtml @@ -0,0 +1 @@ +<%= @params[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_params_method.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_params_method.rhtml new file mode 100644 index 0000000000..7e349b4ca0 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_params_method.rhtml @@ -0,0 +1 @@ +<%= params[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml new file mode 100644 index 0000000000..3acc1b8529 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_session_ivar.rhtml @@ -0,0 +1 @@ +<%= @session[:test] %> diff --git a/actionpack/test/fixtures/deprecated_instance_variables/_session_method.rhtml b/actionpack/test/fixtures/deprecated_instance_variables/_session_method.rhtml new file mode 100644 index 0000000000..a899387c47 --- /dev/null +++ b/actionpack/test/fixtures/deprecated_instance_variables/_session_method.rhtml @@ -0,0 +1 @@ +<%= session[:test] %> diff --git a/actionpack/test/template/deprecated_instance_variables_test.rb b/actionpack/test/template/deprecated_instance_variables_test.rb index 86fc7d6139..277ecdf93d 100644 --- a/actionpack/test/template/deprecated_instance_variables_test.rb +++ b/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 @@ class DeprecatedInstanceVariablesTest < Test::Unit::TestCase 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 |