aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller/metal/helpers.rb12
-rw-r--r--actionpack/test/controller/helper_test.rb15
-rw-r--r--railties/test/railties/configuration_test.rb (renamed from railties/test/plugins/configuration_test.rb)2
-rw-r--r--railties/test/railties/framework_extension_test.rb (renamed from railties/test/plugins/framework_extension_test.rb)2
-rw-r--r--railties/test/railties/plugin_ordering_test.rb72
-rw-r--r--railties/test/railties/plugin_test.rb (renamed from railties/test/plugins/vendored_test.rb)73
6 files changed, 101 insertions, 75 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 %>'
diff --git a/railties/test/plugins/configuration_test.rb b/railties/test/railties/configuration_test.rb
index c59040c712..c5ff6dad9c 100644
--- a/railties/test/plugins/configuration_test.rb
+++ b/railties/test/railties/configuration_test.rb
@@ -1,6 +1,6 @@
require "isolation/abstract_unit"
-module PluginsTest
+module RailtiesTest
class ConfigurationTest < Test::Unit::TestCase
def setup
build_app
diff --git a/railties/test/plugins/framework_extension_test.rb b/railties/test/railties/framework_extension_test.rb
index d57fd4e635..84bd6ed16b 100644
--- a/railties/test/plugins/framework_extension_test.rb
+++ b/railties/test/railties/framework_extension_test.rb
@@ -1,6 +1,6 @@
require "isolation/abstract_unit"
-module PluginsTest
+module RailtiesTest
class FrameworkExtensionTest < Test::Unit::TestCase
include ActiveSupport::Testing::Isolation
diff --git a/railties/test/railties/plugin_ordering_test.rb b/railties/test/railties/plugin_ordering_test.rb
new file mode 100644
index 0000000000..f6ca493fdf
--- /dev/null
+++ b/railties/test/railties/plugin_ordering_test.rb
@@ -0,0 +1,72 @@
+require "isolation/abstract_unit"
+
+module RailtiesTest
+ class PluginOrderingTest < Test::Unit::TestCase
+ include ActiveSupport::Testing::Isolation
+
+ def setup
+ build_app
+ $arr = []
+ plugin "a_plugin", "$arr << :a"
+ plugin "b_plugin", "$arr << :b"
+ plugin "c_plugin", "$arr << :c"
+ end
+
+ def boot_rails
+ super
+ require "#{app_path}/config/environment"
+ end
+
+ test "plugins are loaded alphabetically by default" do
+ boot_rails
+ assert_equal [:a, :b, :c], $arr
+ end
+
+ test "if specified, only those plugins are loaded" do
+ add_to_config "config.plugins = [:b_plugin]"
+ boot_rails
+ assert_equal [:b], $arr
+ end
+
+ test "the plugins are initialized in the order they are specified" do
+ add_to_config "config.plugins = [:b_plugin, :a_plugin]"
+ boot_rails
+ assert_equal [:b, :a], $arr
+ end
+
+ test "if :all is specified, the remaining plugins are loaded in alphabetical order" do
+ add_to_config "config.plugins = [:c_plugin, :all]"
+ boot_rails
+ assert_equal [:c, :a, :b], $arr
+ end
+
+ test "if :all is at the beginning, it represents the plugins not otherwise specified" do
+ add_to_config "config.plugins = [:all, :b_plugin]"
+ boot_rails
+ assert_equal [:a, :c, :b], $arr
+ end
+
+ test "plugin order array is strings" do
+ add_to_config "config.plugins = %w( c_plugin all )"
+ boot_rails
+ assert_equal [:c, :a, :b], $arr
+ end
+
+ test "can require lib file from a different plugin" do
+ plugin "foo", "require 'bar'" do |plugin|
+ plugin.write "lib/foo.rb", "$foo = true"
+ end
+
+ plugin "bar", "require 'foo'" do |plugin|
+ plugin.write "lib/bar.rb", "$bar = true"
+ end
+
+ add_to_config "config.plugins = [:foo, :bar]"
+
+ boot_rails
+
+ assert $foo
+ assert $bar
+ end
+ end
+end \ No newline at end of file
diff --git a/railties/test/plugins/vendored_test.rb b/railties/test/railties/plugin_test.rb
index 940648a0b6..65d057383c 100644
--- a/railties/test/plugins/vendored_test.rb
+++ b/railties/test/railties/plugin_test.rb
@@ -1,7 +1,7 @@
require "isolation/abstract_unit"
-module PluginsTest
- class VendoredTest < Test::Unit::TestCase
+module RailtiesTest
+ class PluginTest < Test::Unit::TestCase
include ActiveSupport::Testing::Isolation
def setup
@@ -331,73 +331,4 @@ YAML
boot_rails
end
end
-
- class VendoredOrderingTest < Test::Unit::TestCase
- include ActiveSupport::Testing::Isolation
-
- def setup
- build_app
- $arr = []
- plugin "a_plugin", "$arr << :a"
- plugin "b_plugin", "$arr << :b"
- plugin "c_plugin", "$arr << :c"
- end
-
- def boot_rails
- super
- require "#{app_path}/config/environment"
- end
-
- test "plugins are loaded alphabetically by default" do
- boot_rails
- assert_equal [:a, :b, :c], $arr
- end
-
- test "if specified, only those plugins are loaded" do
- add_to_config "config.plugins = [:b_plugin]"
- boot_rails
- assert_equal [:b], $arr
- end
-
- test "the plugins are initialized in the order they are specified" do
- add_to_config "config.plugins = [:b_plugin, :a_plugin]"
- boot_rails
- assert_equal [:b, :a], $arr
- end
-
- test "if :all is specified, the remaining plugins are loaded in alphabetical order" do
- add_to_config "config.plugins = [:c_plugin, :all]"
- boot_rails
- assert_equal [:c, :a, :b], $arr
- end
-
- test "if :all is at the beginning, it represents the plugins not otherwise specified" do
- add_to_config "config.plugins = [:all, :b_plugin]"
- boot_rails
- assert_equal [:a, :c, :b], $arr
- end
-
- test "plugin order array is strings" do
- add_to_config "config.plugins = %w( c_plugin all )"
- boot_rails
- assert_equal [:c, :a, :b], $arr
- end
-
- test "can require lib file from a different plugin" do
- plugin "foo", "require 'bar'" do |plugin|
- plugin.write "lib/foo.rb", "$foo = true"
- end
-
- plugin "bar", "require 'foo'" do |plugin|
- plugin.write "lib/bar.rb", "$bar = true"
- end
-
- add_to_config "config.plugins = [:foo, :bar]"
-
- boot_rails
-
- assert $foo
- assert $bar
- end
- end
end