aboutsummaryrefslogtreecommitdiffstats
path: root/railties/test/plugin_locator_test.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2008-04-21 13:24:38 -0500
committerJoshua Peek <josh@joshpeek.com>2008-04-21 13:24:38 -0500
commiteef9002968609a0d8d4a8006aebcd6f18f993f4a (patch)
tree753d9acc440af82eea1e76ad218c8745021e9a8c /railties/test/plugin_locator_test.rb
parent1642b2362ecd627c5bdd9965ff3d527a95e2b244 (diff)
downloadrails-eef9002968609a0d8d4a8006aebcd6f18f993f4a.tar.gz
rails-eef9002968609a0d8d4a8006aebcd6f18f993f4a.tar.bz2
rails-eef9002968609a0d8d4a8006aebcd6f18f993f4a.zip
Update plugin loading tests to reflect changes in plugin fixtures.
Diffstat (limited to 'railties/test/plugin_locator_test.rb')
-rw-r--r--railties/test/plugin_locator_test.rb27
1 files changed, 12 insertions, 15 deletions
diff --git a/railties/test/plugin_locator_test.rb b/railties/test/plugin_locator_test.rb
index 5f1dd991ea..a7a76e1cd0 100644
--- a/railties/test/plugin_locator_test.rb
+++ b/railties/test/plugin_locator_test.rb
@@ -3,13 +3,13 @@ require 'plugin_test_helper'
uses_mocha "Plugin Locator Tests" do
class PluginLocatorTest < Test::Unit::TestCase
-
+
def test_should_require_subclasses_to_implement_the_plugins_method
assert_raises(RuntimeError) do
Rails::Plugin::Locator.new(nil).plugins
end
end
-
+
def test_should_iterator_over_plugins_returned_by_plugins_when_calling_each
locator = Rails::Plugin::Locator.new(nil)
locator.stubs(:plugins).returns([:a, :b, :c])
@@ -17,12 +17,12 @@ uses_mocha "Plugin Locator Tests" do
plugin_consumer.expects(:consume).with(:a)
plugin_consumer.expects(:consume).with(:b)
plugin_consumer.expects(:consume).with(:c)
-
+
locator.each do |plugin|
plugin_consumer.consume(plugin)
end
end
-
+
end
@@ -39,25 +39,22 @@ uses_mocha "Plugin Locator Tests" do
end
def test_should_return_rails_plugin_instances_when_calling_create_plugin_with_a_valid_plugin_directory
- assert_kind_of Rails::Plugin, @locator.send(:create_plugin, @valid_plugin_path)
+ assert_kind_of Rails::Plugin, @locator.send(:create_plugin, @valid_plugin_path)
end
-
+
def test_should_return_nil_when_calling_create_plugin_with_an_invalid_plugin_directory
- assert_nil @locator.send(:create_plugin, @empty_plugin_path)
+ assert_nil @locator.send(:create_plugin, @empty_plugin_path)
end
-
+
def test_should_return_all_plugins_found_under_the_set_plugin_paths
- assert_equal ["a", "acts_as_chunky_bacon", "plugin_with_no_lib_dir", "stubby"].sort, @locator.plugins.map(&:name).sort
+ assert_equal ["plugin_with_no_lib_dir", "stubby"].sort, @locator.plugins.map(&:name).sort
end
-
+
def test_should_find_plugins_only_under_the_plugin_paths_set_in_configuration
@configuration.plugin_paths = [File.join(plugin_fixture_root_path, "default")]
- assert_equal ["acts_as_chunky_bacon", "plugin_with_no_lib_dir", "stubby"].sort, @locator.plugins.map(&:name).sort
-
- @configuration.plugin_paths = [File.join(plugin_fixture_root_path, "alternate")]
- assert_equal ["a"], @locator.plugins.map(&:name)
+ assert_equal ["plugin_with_no_lib_dir", "stubby"].sort, @locator.plugins.map(&:name).sort
end
-
+
def test_should_not_raise_any_error_and_return_no_plugins_if_the_plugin_path_value_does_not_exist
@configuration.plugin_paths = ["some_missing_directory"]
assert_nothing_raised do