Sha256: 01d08eb6ca188ba9c314262c843e877c20863be5495f1b089f703d9740d01312

Contents?: true

Size: 1.54 KB

Versions: 22

Compression:

Stored size: 1.54 KB

Contents

require File.dirname(__FILE__) + '/../abstract_unit'

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}_inline;  render :inline => '<%= @#{var}.to_s %>'  end
        def new_#{var}_inline;  render :inline => '<%= #{var}.to_s %>'   end
        def old_#{var}_partial; render :partial => '#{var}_ivar'    end
        def new_#{var}_partial; render :partial => '#{var}_method'  end
      end_eval
    end

    def rescue_action(e) raise e end
  end

  def setup
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.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}_inline }
      end
      def test_new_#{var}_isnt_deprecated
        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
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
jstorimer-deep-test-2.0.0 sample_rails_project/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
jstorimer-deep-test-1.4.0 sample_rails_project/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
jstorimer-deep-test-1.3.0 sample_rails_project/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
jstorimer-deep-test-1.2.0 sample_rails_project/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
jstorimer-deep-test-1.1.0 sample_rails_project/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
jstorimer-deep-test-1.0.0 sample_rails_project/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
jstorimer-deep-test-0.2.0 sample_rails_project/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
jstorimer-deep-test-0.1.0 sample_rails_project/vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
actionpack-1.13.0 test/template/deprecated_instance_variables_test.rb
actionpack-1.13.1 test/template/deprecated_instance_variables_test.rb
actionpack-1.13.4 test/template/deprecated_instance_variables_test.rb
actionpack-1.13.6 test/template/deprecated_instance_variables_test.rb
actionpack-1.13.2 test/template/deprecated_instance_variables_test.rb
actionpack-1.13.3 test/template/deprecated_instance_variables_test.rb
actionpack-1.13.5 test/template/deprecated_instance_variables_test.rb
radiant-0.6.1 vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
radiant-0.6.0 vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
radiant-0.6.2 vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
radiant-0.6.3 vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb
radiant-0.6.4 vendor/rails/actionpack/test/template/deprecated_instance_variables_test.rb