diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-25 23:38:47 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-25 23:38:47 +0100 |
commit | 49be3316c21ae1b779fc26a5eb51890deff56915 (patch) | |
tree | 9a51ec862ac69b30473f7990d3ab2c23afac3c4b | |
parent | cc1bb8590e6021e0c86b345857358704fa68c9eb (diff) | |
download | rails-49be3316c21ae1b779fc26a5eb51890deff56915.tar.gz rails-49be3316c21ae1b779fc26a5eb51890deff56915.tar.bz2 rails-49be3316c21ae1b779fc26a5eb51890deff56915.zip |
Add a deprecation for helpers_dir.
-rw-r--r-- | actionpack/lib/action_controller/metal/helpers.rb | 12 | ||||
-rw-r--r-- | actionpack/test/controller/helper_test.rb | 15 |
2 files changed, 25 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/helpers.rb b/actionpack/lib/action_controller/metal/helpers.rb index 0e3db86861..ef3b89db14 100644 --- a/actionpack/lib/action_controller/metal/helpers.rb +++ b/actionpack/lib/action_controller/metal/helpers.rb @@ -56,6 +56,18 @@ module ActionController 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 diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index fe0961e575..75a96d6497 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -31,7 +31,7 @@ module LocalAbcHelper 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 @@ class HelperTest < Test::Unit::TestCase 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 @@ class HelperTest < Test::Unit::TestCase end -class IsolatedHelpersTest < Test::Unit::TestCase +class IsolatedHelpersTest < ActiveSupport::TestCase class A < ActionController::Base def index render :inline => '<%= shout %>' |