aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-09-21 22:31:19 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-09-21 22:31:19 +0000
commit6dd10d85dab9d2623deb3dc4a61106ca9be1d981 (patch)
tree7180753dbf40f804418b983f542d66b3fb3c5e1b /railties/test
parent83c17f208933bb895faf9a18194f8a407c194f05 (diff)
downloadrails-6dd10d85dab9d2623deb3dc4a61106ca9be1d981.tar.gz
rails-6dd10d85dab9d2623deb3dc4a61106ca9be1d981.tar.bz2
rails-6dd10d85dab9d2623deb3dc4a61106ca9be1d981.zip
Added the :all option to config.plugins thatll include the rest of the plugins not already explicitly named (closes #9613) [fcheung]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7531 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/test')
-rw-r--r--railties/test/plugin_loader_test.rb12
-rw-r--r--railties/test/plugin_locator_test.rb14
2 files changed, 26 insertions, 0 deletions
diff --git a/railties/test/plugin_loader_test.rb b/railties/test/plugin_loader_test.rb
index 911f854f75..3c2c37e794 100644
--- a/railties/test/plugin_loader_test.rb
+++ b/railties/test/plugin_loader_test.rb
@@ -14,6 +14,18 @@ class TestPluginLoader < Test::Unit::TestCase
assert loader.send(:explicit_plugin_loading_order?)
end
+ def test_enabled_if_not_named_explicitly
+ stubby_loader = loader_for(@valid_plugin_path)
+ acts_as_loader = loader_for('acts_as/acts_as_chunky_bacon')
+
+ only_load_the_following_plugins! ['stubby', :all]
+ assert stubby_loader.send(:enabled?)
+ assert acts_as_loader.send(:enabled?)
+
+ assert stubby_loader.send(:explicitly_enabled?)
+ assert !acts_as_loader.send(:explicitly_enabled?)
+ end
+
def test_determining_whether_a_given_plugin_is_loaded
plugin_loader = loader_for(@valid_plugin_path)
assert !plugin_loader.loaded?
diff --git a/railties/test/plugin_locator_test.rb b/railties/test/plugin_locator_test.rb
index 36f9e272e4..cf6c0d9507 100644
--- a/railties/test/plugin_locator_test.rb
+++ b/railties/test/plugin_locator_test.rb
@@ -26,6 +26,20 @@ class TestPluginFileSystemLocator < Test::Unit::TestCase
assert_equal %w(a acts_as_chunky_bacon plugin_with_no_lib_dir stubby), @locator.plugin_names, failure_tip
end
+ def test_all_plugins_loaded_when_all_is_used
+ plugin_names = ['stubby', 'acts_as_chunky_bacon', :all]
+ only_load_the_following_plugins! plugin_names
+ failure_tip = "It's likely someone has added a new plugin fixture without updating this list"
+ assert_equal %w(stubby acts_as_chunky_bacon a plugin_with_no_lib_dir), @locator.plugin_names, failure_tip
+ end
+
+ def test_all_plugins_loaded_after_all
+ plugin_names = ['stubby', :all, 'acts_as_chunky_bacon']
+ only_load_the_following_plugins! plugin_names
+ failure_tip = "It's likely someone has added a new plugin fixture without updating this list"
+ assert_equal %w(stubby a plugin_with_no_lib_dir acts_as_chunky_bacon ), @locator.plugin_names, failure_tip
+ end
+
def test_registering_a_plugin_name_that_does_not_exist_raises_a_load_error
only_load_the_following_plugins! %w(stubby acts_as_a_non_existant_plugin)