Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
dd05b6c5
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,体验更适合开发者的 AI 搜索 >>
提交
dd05b6c5
编写于
1月 24, 2010
作者:
J
José Valim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add tests for plugin sanity check.
上级
e548f96b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
27 addition
and
3 deletion
+27
-3
railties/lib/rails/engine/configurable.rb
railties/lib/rails/engine/configurable.rb
+2
-1
railties/lib/rails/plugin.rb
railties/lib/rails/plugin.rb
+1
-2
railties/test/plugins/vendored_test.rb
railties/test/plugins/vendored_test.rb
+24
-0
未找到文件。
railties/lib/rails/engine/configurable.rb
浏览文件 @
dd05b6c5
...
...
@@ -3,10 +3,11 @@ class Engine
module
Configurable
def
self
.
included
(
base
)
base
.
extend
ClassMethods
base
.
delegate
:middleware
,
:root
,
:paths
,
:to
=>
:config
end
module
ClassMethods
delegate
:middleware
,
:root
,
:paths
,
:to
=>
:config
def
config
@config
||=
Engine
::
Configuration
.
new
(
find_root_with_flag
(
"lib"
))
end
...
...
railties/lib/rails/plugin.rb
浏览文件 @
dd05b6c5
...
...
@@ -49,10 +49,9 @@ def config
eval
(
File
.
read
(
file
),
binding
,
file
)
if
file
&&
File
.
file?
(
file
)
end
# TODO Write tests for this sanity check
initializer
:sanity_check_railties_collision
do
if
Engine
.
subclasses
.
map
{
|
k
|
k
.
root
.
to_s
}.
include?
(
root
.
to_s
)
raise
"
The plugin
#{
name
.
inspect
}
is a Railtie or an Engine and cannot be installed as P
lugin"
raise
"
\"
#{
name
}
\"
is a Railtie/Engine and cannot be installed as p
lugin"
end
end
end
...
...
railties/test/plugins/vendored_test.rb
浏览文件 @
dd05b6c5
...
...
@@ -247,6 +247,30 @@ def index
assert_equal
200
,
last_response
.
status
assert_equal
"Rendered from namespace"
,
last_response
.
body
end
test
"plugin cannot declare an engine for it"
do
@plugin
.
write
"lib/bukkits.rb"
,
<<-
RUBY
class Bukkits
class Engine < Rails::Engine
end
end
RUBY
@plugin
.
write
"init.rb"
,
<<-
RUBY
require "bukkits"
RUBY
rescued
=
false
begin
boot_rails
rescue
Exception
=>
e
rescued
=
true
assert_equal
'"bukkits" is a Railtie/Engine and cannot be installed as plugin'
,
e
.
message
end
assert
rescued
,
"Expected boot rails to fail"
end
end
class
VendoredOrderingTest
<
Test
::
Unit
::
TestCase
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录