|
Revision 8115, 0.8 kB
(checked in by rick, 1 year ago)
|
Refactor Plugin Loader. Add plugin lib paths early, and add lots of tests. Closes #9795 [lazyatom]
|
| Line | |
|---|
| 1 |
$:.unshift File.dirname(__FILE__) + "/../lib" |
|---|
| 2 |
$:.unshift File.dirname(__FILE__) + "/../../activesupport/lib" |
|---|
| 3 |
|
|---|
| 4 |
require 'test/unit' |
|---|
| 5 |
require 'active_support' |
|---|
| 6 |
require 'initializer' |
|---|
| 7 |
require File.join(File.dirname(__FILE__), 'abstract_unit') |
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
RAILS_ROOT = '.' unless defined?(RAILS_ROOT) |
|---|
| 11 |
|
|---|
| 12 |
class Test::Unit::TestCase |
|---|
| 13 |
private |
|---|
| 14 |
def plugin_fixture_root_path |
|---|
| 15 |
File.join(File.dirname(__FILE__), 'fixtures', 'plugins') |
|---|
| 16 |
end |
|---|
| 17 |
|
|---|
| 18 |
def only_load_the_following_plugins!(plugins) |
|---|
| 19 |
@initializer.configuration.plugins = plugins |
|---|
| 20 |
end |
|---|
| 21 |
|
|---|
| 22 |
def plugin_fixture_path(path) |
|---|
| 23 |
File.join(plugin_fixture_root_path, path) |
|---|
| 24 |
end |
|---|
| 25 |
|
|---|
| 26 |
def assert_plugins(list_of_names, array_of_plugins, message=nil) |
|---|
| 27 |
assert_equal list_of_names.map(&:to_s), array_of_plugins.map(&:name), message |
|---|
| 28 |
end |
|---|
| 29 |
end |
|---|