Sha256: 70fcb774825106f2cba05e5333b3d15f92747e6fbc544019650a0e319ec746ff

Contents?: true

Size: 1.48 KB

Versions: 56

Compression:

Stored size: 1.48 KB

Contents

require File.dirname(__FILE__) + '/plugin_test_helper'

class TestPluginFileSystemLocator < Test::Unit::TestCase
  def setup
    configuration = Rails::Configuration.new
    # We need to add our testing plugin directory to the plugin paths so
    # the locator knows where to look for our plugins
    configuration.plugin_paths << plugin_fixture_root_path
    @initializer = Rails::Initializer.new(configuration)
    @locator     = new_locator
  end
  
  def test_no_plugins_are_loaded_if_the_configuration_has_an_empty_plugin_list
    only_load_the_following_plugins! []
    assert_equal [], @locator.plugins
  end
  
  def test_only_the_specified_plugins_are_located_in_the_order_listed
    plugin_names = %w(stubby acts_as_chunky_bacon)
    only_load_the_following_plugins! plugin_names
    assert_equal plugin_names, @locator.plugin_names
  end
  
  def test_all_plugins_are_loaded_when_registered_plugin_list_is_untouched
    failure_tip = "It's likely someone has added a new plugin fixture without updating this list"
    assert_equal %w(a acts_as_chunky_bacon plugin_with_no_lib_dir stubby), @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)
    assert_raises(LoadError) do
      @initializer.load_plugins
    end
  end
  
  private
    def new_locator(initializer = @initializer)
      Rails::Plugin::FileSystemLocator.new(initializer)
    end   
end

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
backlog-0.0.0 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.0.1 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.0.2 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.0.5 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.0.4 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.1.0 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.1.1 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.1.2 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.2.0 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.2.1 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.0 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.2 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.3 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.1 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.4 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.6 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.5 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.7 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.8 vendor/rails/railties/test/plugin_locator_test.rb
backlog-0.3.9 vendor/rails/railties/test/plugin_locator_test.rb