0
@@ -11,18 +11,18 @@ uses_mocha "Plugin Loader Tests" do
0
class TestPluginLoader < Test::Unit::TestCase
0
ORIGINAL_LOAD_PATH = $LOAD_PATH.dup
0
@configuration = Rails::Configuration.new
0
@configuration.plugin_paths << plugin_fixture_root_path
0
@initializer = Rails::Initializer.new(@configuration)
0
@valid_plugin_path = plugin_fixture_path('default/stubby')
0
@empty_plugin_path = plugin_fixture_path('default/empty')
0
@failure_tip = "It's likely someone has added a new plugin fixture without updating this list"
0
@loader = Rails::Plugin::Loader.new(@initializer)
0
@@ -34,27 +34,27 @@ uses_mocha "Plugin Loader Tests" do
0
@configuration.plugin_locators = [locator_class_1, locator_class_2]
0
assert_equal [:a, :b, :c, :d, :e, :f], @loader.send(:locate_plugins)
0
def test_should_memoize_the_result_of_locate_plugins_as_all_plugins
0
plugin_list = [:a, :b, :c]
0
@loader.expects(:locate_plugins).once.returns(plugin_list)
0
assert_equal plugin_list, @loader.all_plugins
0
assert_equal plugin_list, @loader.all_plugins # ensuring that locate_plugins isn't called again
0
def test_should_return_empty_array_if_configuration_plugins_is_empty
0
@configuration.plugins = []
0
assert_equal [], @loader.plugins
0
def test_should_find_all_availble_plugins_and_return_as_all_plugins
0
- assert_plugins [:
a, :acts_as_chunky_bacon, :plugin_with_no_lib_dir, :stubby], @loader.all_plugins.reverse, @failure_tip
0
+ assert_plugins [:
stubby, :plugin_with_no_lib_dir, :acts_as_chunky_bacon, :a], @loader.all_plugins.reverse, @failure_tip
0
def test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_untouched
0
assert_plugins [:a, :acts_as_chunky_bacon, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
def test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_nil
0
@configuration.plugins = nil
0
assert_plugins [:a, :acts_as_chunky_bacon, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
@@ -65,23 +65,23 @@ uses_mocha "Plugin Loader Tests" do
0
only_load_the_following_plugins! plugin_names
0
assert_plugins plugin_names, @loader.plugins
0
def test_should_respect_the_order_of_plugins_given_in_configuration
0
plugin_names = [:stubby, :acts_as_chunky_bacon]
0
only_load_the_following_plugins! plugin_names
0
- assert_plugins plugin_names, @loader.plugins
0
+ assert_plugins plugin_names, @loader.plugins
0
def test_should_load_all_plugins_in_natural_order_when_all_is_used
0
only_load_the_following_plugins! [:all]
0
assert_plugins [:a, :acts_as_chunky_bacon, :plugin_with_no_lib_dir, :stubby], @loader.plugins, @failure_tip
0
def test_should_load_specified_plugins_in_order_and_then_all_remaining_plugins_when_all_is_used
0
only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon, :all]
0
assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :plugin_with_no_lib_dir], @loader.plugins, @failure_tip
0
def test_should_be_able_to_specify_loading_of_plugins_loaded_after_all
0
only_load_the_following_plugins! [:stubby, :all, :acts_as_chunky_bacon]
0
assert_plugins [:stubby, :a, :plugin_with_no_lib_dir, :acts_as_chunky_bacon], @loader.plugins, @failure_tip
0
@@ -91,52 +91,52 @@ uses_mocha "Plugin Loader Tests" do
0
only_load_the_following_plugins! ['stubby', 'acts_as_chunky_bacon', :a, :plugin_with_no_lib_dir]
0
assert_plugins [:stubby, :acts_as_chunky_bacon, :a, :plugin_with_no_lib_dir], @loader.plugins, @failure_tip
0
def test_should_add_plugin_load_paths_to_global_LOAD_PATH_array
0
only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon]
0
stubbed_application_lib_index_in_LOAD_PATHS = 5
0
@loader.stubs(:application_lib_index).returns(stubbed_application_lib_index_in_LOAD_PATHS)
0
@loader.add_plugin_load_paths
0
assert $LOAD_PATH.index(File.join(plugin_fixture_path('default/stubby'), 'lib')) >= stubbed_application_lib_index_in_LOAD_PATHS
0
- assert $LOAD_PATH.index(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib')) >= stubbed_application_lib_index_in_LOAD_PATHS
0
+ assert $LOAD_PATH.index(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib')) >= stubbed_application_lib_index_in_LOAD_PATHS
0
def test_should_add_plugin_load_paths_to_Dependencies_load_paths
0
only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon]
0
@loader.add_plugin_load_paths
0
assert Dependencies.load_paths.include?(File.join(plugin_fixture_path('default/stubby'), 'lib'))
0
- assert Dependencies.load_paths.include?(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib'))
0
+ assert Dependencies.load_paths.include?(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib'))
0
def test_should_add_plugin_load_paths_to_Dependencies_load_once_paths
0
only_load_the_following_plugins! [:stubby, :acts_as_chunky_bacon]
0
@loader.add_plugin_load_paths
0
assert Dependencies.load_once_paths.include?(File.join(plugin_fixture_path('default/stubby'), 'lib'))
0
- assert Dependencies.load_once_paths.include?(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib'))
0
+ assert Dependencies.load_once_paths.include?(File.join(plugin_fixture_path('default/acts/acts_as_chunky_bacon'), 'lib'))
0
def test_should_add_all_load_paths_from_a_plugin_to_LOAD_PATH_array
0
plugin_load_paths = ["a", "b"]
0
plugin = stub(:load_paths => plugin_load_paths)
0
@loader.stubs(:plugins).returns([plugin])
0
@loader.add_plugin_load_paths
0
plugin_load_paths.each { |path| assert $LOAD_PATH.include?(path) }
0
- ORIGINAL_LOAD_PATH.each { |path| $LOAD_PATH << path }
0
+ ORIGINAL_LOAD_PATH.each { |path| $LOAD_PATH << path }
Comments
No one has commented yet.