提交 49be3316 编写于 作者: J José Valim

Add a deprecation for helpers_dir.

上级 cc1bb859
......@@ -56,6 +56,18 @@ module Helpers
end
module ClassMethods
def helpers_dir
ActiveSupport::Deprecation.warn "ActionController::Base.helpers_dir is deprecated. " <<
"Please use ActionController::Base.helpers_path (which returns an array)"
self.helpers_path
end
def helpers_dir=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.helpers_dir= is deprecated. " <<
"Please use ActionController::Base.helpers_path= (which is an array)"
self.helpers_path = Array(value)
end
def inherited(klass)
klass.class_eval { default_helper_module! unless name.blank? }
super
......
......@@ -31,7 +31,7 @@ def b() end
def c() end
end
class HelperTest < Test::Unit::TestCase
class HelperTest < ActiveSupport::TestCase
class TestController < ActionController::Base
attr_accessor :delegate_attr
def delegate_method() end
......@@ -135,6 +135,17 @@ def test_helper_proxy
assert methods.include?('foobar')
end
def test_deprecation
assert_deprecated do
ActionController::Base.helpers_dir = "some/foo/bar"
end
assert_deprecated do
assert_equal ["some/foo/bar"], ActionController::Base.helpers_dir
end
ensure
ActionController::Base.helpers_path = [File.dirname(__FILE__) + '/../fixtures/helpers']
end
private
def expected_helper_methods
TestHelper.instance_methods.map {|m| m.to_s }
......@@ -154,7 +165,7 @@ def test_helper=(helper_module)
end
class IsolatedHelpersTest < Test::Unit::TestCase
class IsolatedHelpersTest < ActiveSupport::TestCase
class A < ActionController::Base
def index
render :inline => '<%= shout %>'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册