Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
4ac33de4
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4ac33de4
编写于
4月 21, 2008
作者:
J
Joshua Peek
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add back empty plugin folders that were lost when we moved to git.
上级
1d09ccd9
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
32 deletion
+32
-32
railties/test/fixtures/plugins/alternate/a/lib/a.rb
railties/test/fixtures/plugins/alternate/a/lib/a.rb
+0
-0
railties/test/fixtures/plugins/default/acts/acts_as_chunky_bacon/lib/acts_as_chunky_bacon.rb
...ult/acts/acts_as_chunky_bacon/lib/acts_as_chunky_bacon.rb
+0
-0
railties/test/fixtures/plugins/default/empty/README
railties/test/fixtures/plugins/default/empty/README
+0
-0
railties/test/plugin_loader_test.rb
railties/test/plugin_loader_test.rb
+32
-32
未找到文件。
railties/test/fixtures/plugins/alternate/a/lib/a.rb
0 → 100644
浏览文件 @
4ac33de4
railties/test/fixtures/plugins/default/acts/acts_as_chunky_bacon/lib/acts_as_chunky_bacon.rb
0 → 100644
浏览文件 @
4ac33de4
railties/test/fixtures/plugins/default/empty/README
0 → 100644
浏览文件 @
4ac33de4
railties/test/plugin_loader_test.rb
浏览文件 @
4ac33de4
...
...
@@ -11,18 +11,18 @@ def self.configuration
class
TestPluginLoader
<
Test
::
Unit
::
TestCase
ORIGINAL_LOAD_PATH
=
$LOAD_PATH
.
dup
def
setup
reset_load_path!
@configuration
=
Rails
::
Configuration
.
new
@configuration
.
plugin_paths
<<
plugin_fixture_root_path
@initializer
=
Rails
::
Initializer
.
new
(
@configuration
)
@valid_plugin_path
=
plugin_fixture_path
(
'default/stubby'
)
@empty_plugin_path
=
plugin_fixture_path
(
'default/empty'
)
@failure_tip
=
"It's likely someone has added a new plugin fixture without updating this list"
@loader
=
Rails
::
Plugin
::
Loader
.
new
(
@initializer
)
end
...
...
@@ -34,27 +34,27 @@ def test_should_locate_plugins_by_asking_each_locator_specifed_in_configuration_
@configuration
.
plugin_locators
=
[
locator_class_1
,
locator_class_2
]
assert_equal
[
:a
,
:b
,
:c
,
:d
,
:e
,
:f
],
@loader
.
send
(
:locate_plugins
)
end
def
test_should_memoize_the_result_of_locate_plugins_as_all_plugins
plugin_list
=
[
:a
,
:b
,
:c
]
@loader
.
expects
(
:locate_plugins
).
once
.
returns
(
plugin_list
)
assert_equal
plugin_list
,
@loader
.
all_plugins
assert_equal
plugin_list
,
@loader
.
all_plugins
# ensuring that locate_plugins isn't called again
end
def
test_should_return_empty_array_if_configuration_plugins_is_empty
@configuration
.
plugins
=
[]
assert_equal
[],
@loader
.
plugins
end
def
test_should_find_all_availble_plugins_and_return_as_all_plugins
assert_plugins
[
:
a
,
:acts_as_chunky_bacon
,
:plugin_with_no_lib_dir
,
:stubby
],
@loader
.
all_plugins
.
reverse
,
@failure_tip
assert_plugins
[
:
stubby
,
:plugin_with_no_lib_dir
,
:acts_as_chunky_bacon
,
:a
],
@loader
.
all_plugins
.
reverse
,
@failure_tip
end
def
test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_untouched
assert_plugins
[
:a
,
:acts_as_chunky_bacon
,
:plugin_with_no_lib_dir
,
:stubby
],
@loader
.
plugins
,
@failure_tip
end
def
test_should_return_all_plugins_as_plugins_when_registered_plugin_list_is_nil
@configuration
.
plugins
=
nil
assert_plugins
[
:a
,
:acts_as_chunky_bacon
,
:plugin_with_no_lib_dir
,
:stubby
],
@loader
.
plugins
,
@failure_tip
...
...
@@ -65,23 +65,23 @@ def test_should_return_specific_plugins_named_in_config_plugins_array_if_set
only_load_the_following_plugins!
plugin_names
assert_plugins
plugin_names
,
@loader
.
plugins
end
def
test_should_respect_the_order_of_plugins_given_in_configuration
plugin_names
=
[
:stubby
,
:acts_as_chunky_bacon
]
only_load_the_following_plugins!
plugin_names
assert_plugins
plugin_names
,
@loader
.
plugins
assert_plugins
plugin_names
,
@loader
.
plugins
end
def
test_should_load_all_plugins_in_natural_order_when_all_is_used
only_load_the_following_plugins!
[
:all
]
assert_plugins
[
:a
,
:acts_as_chunky_bacon
,
:plugin_with_no_lib_dir
,
:stubby
],
@loader
.
plugins
,
@failure_tip
end
def
test_should_load_specified_plugins_in_order_and_then_all_remaining_plugins_when_all_is_used
only_load_the_following_plugins!
[
:stubby
,
:acts_as_chunky_bacon
,
:all
]
assert_plugins
[
:stubby
,
:acts_as_chunky_bacon
,
:a
,
:plugin_with_no_lib_dir
],
@loader
.
plugins
,
@failure_tip
end
def
test_should_be_able_to_specify_loading_of_plugins_loaded_after_all
only_load_the_following_plugins!
[
:stubby
,
:all
,
:acts_as_chunky_bacon
]
assert_plugins
[
:stubby
,
:a
,
:plugin_with_no_lib_dir
,
:acts_as_chunky_bacon
],
@loader
.
plugins
,
@failure_tip
...
...
@@ -91,52 +91,52 @@ def test_should_accept_plugin_names_given_as_strings
only_load_the_following_plugins!
[
'stubby'
,
'acts_as_chunky_bacon'
,
:a
,
:plugin_with_no_lib_dir
]
assert_plugins
[
:stubby
,
:acts_as_chunky_bacon
,
:a
,
:plugin_with_no_lib_dir
],
@loader
.
plugins
,
@failure_tip
end
def
test_should_add_plugin_load_paths_to_global_LOAD_PATH_array
only_load_the_following_plugins!
[
:stubby
,
:acts_as_chunky_bacon
]
stubbed_application_lib_index_in_LOAD_PATHS
=
5
@loader
.
stubs
(
:application_lib_index
).
returns
(
stubbed_application_lib_index_in_LOAD_PATHS
)
@loader
.
add_plugin_load_paths
assert
$LOAD_PATH
.
index
(
File
.
join
(
plugin_fixture_path
(
'default/stubby'
),
'lib'
))
>=
stubbed_application_lib_index_in_LOAD_PATHS
assert
$LOAD_PATH
.
index
(
File
.
join
(
plugin_fixture_path
(
'default/acts/acts_as_chunky_bacon'
),
'lib'
))
>=
stubbed_application_lib_index_in_LOAD_PATHS
end
assert
$LOAD_PATH
.
index
(
File
.
join
(
plugin_fixture_path
(
'default/acts/acts_as_chunky_bacon'
),
'lib'
))
>=
stubbed_application_lib_index_in_LOAD_PATHS
end
def
test_should_add_plugin_load_paths_to_Dependencies_load_paths
only_load_the_following_plugins!
[
:stubby
,
:acts_as_chunky_bacon
]
@loader
.
add_plugin_load_paths
assert
Dependencies
.
load_paths
.
include?
(
File
.
join
(
plugin_fixture_path
(
'default/stubby'
),
'lib'
))
assert
Dependencies
.
load_paths
.
include?
(
File
.
join
(
plugin_fixture_path
(
'default/acts/acts_as_chunky_bacon'
),
'lib'
))
assert
Dependencies
.
load_paths
.
include?
(
File
.
join
(
plugin_fixture_path
(
'default/acts/acts_as_chunky_bacon'
),
'lib'
))
end
def
test_should_add_plugin_load_paths_to_Dependencies_load_once_paths
only_load_the_following_plugins!
[
:stubby
,
:acts_as_chunky_bacon
]
@loader
.
add_plugin_load_paths
assert
Dependencies
.
load_once_paths
.
include?
(
File
.
join
(
plugin_fixture_path
(
'default/stubby'
),
'lib'
))
assert
Dependencies
.
load_once_paths
.
include?
(
File
.
join
(
plugin_fixture_path
(
'default/acts/acts_as_chunky_bacon'
),
'lib'
))
assert
Dependencies
.
load_once_paths
.
include?
(
File
.
join
(
plugin_fixture_path
(
'default/acts/acts_as_chunky_bacon'
),
'lib'
))
end
def
test_should_add_all_load_paths_from_a_plugin_to_LOAD_PATH_array
plugin_load_paths
=
[
"a"
,
"b"
]
plugin
=
stub
(
:load_paths
=>
plugin_load_paths
)
@loader
.
stubs
(
:plugins
).
returns
([
plugin
])
@loader
.
add_plugin_load_paths
plugin_load_paths
.
each
{
|
path
|
assert
$LOAD_PATH
.
include?
(
path
)
}
end
private
def
reset_load_path!
$LOAD_PATH
.
clear
ORIGINAL_LOAD_PATH
.
each
{
|
path
|
$LOAD_PATH
<<
path
}
ORIGINAL_LOAD_PATH
.
each
{
|
path
|
$LOAD_PATH
<<
path
}
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录