Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
546497d0
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,发现更多精彩内容 >>
提交
546497d0
编写于
8月 13, 2012
作者:
R
Rafael Mendonça França
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract common controllers to abstract_unit
上级
0dd24728
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
45 deletion
+33
-45
actionpack/test/abstract_unit.rb
actionpack/test/abstract_unit.rb
+29
-0
actionpack/test/controller/resources_test.rb
actionpack/test/controller/resources_test.rb
+0
-29
actionpack/test/dispatch/routing/concerns_test.rb
actionpack/test/dispatch/routing/concerns_test.rb
+4
-16
未找到文件。
actionpack/test/abstract_unit.rb
浏览文件 @
546497d0
...
...
@@ -349,3 +349,32 @@ def url_for(set, options, recall = nil)
set
.
send
(
:url_for
,
options
.
merge
(
:only_path
=>
true
,
:_recall
=>
recall
))
end
end
class
ResourcesController
<
ActionController
::
Base
def
index
()
render
:nothing
=>
true
end
alias_method
:show
,
:index
end
class
ThreadsController
<
ResourcesController
;
end
class
MessagesController
<
ResourcesController
;
end
class
CommentsController
<
ResourcesController
;
end
class
AuthorsController
<
ResourcesController
;
end
class
LogosController
<
ResourcesController
;
end
class
AccountsController
<
ResourcesController
;
end
class
AdminController
<
ResourcesController
;
end
class
ProductsController
<
ResourcesController
;
end
class
ImagesController
<
ResourcesController
;
end
class
PreferencesController
<
ResourcesController
;
end
module
Backoffice
class
ProductsController
<
ResourcesController
;
end
class
TagsController
<
ResourcesController
;
end
class
ManufacturersController
<
ResourcesController
;
end
class
ImagesController
<
ResourcesController
;
end
module
Admin
class
ProductsController
<
ResourcesController
;
end
class
ImagesController
<
ResourcesController
;
end
end
end
actionpack/test/controller/resources_test.rb
浏览文件 @
546497d0
...
...
@@ -2,35 +2,6 @@
require
'active_support/core_ext/object/try'
require
'active_support/core_ext/object/with_options'
class
ResourcesController
<
ActionController
::
Base
def
index
()
render
:nothing
=>
true
end
alias_method
:show
,
:index
end
class
ThreadsController
<
ResourcesController
;
end
class
MessagesController
<
ResourcesController
;
end
class
CommentsController
<
ResourcesController
;
end
class
AuthorsController
<
ResourcesController
;
end
class
LogosController
<
ResourcesController
;
end
class
AccountsController
<
ResourcesController
;
end
class
AdminController
<
ResourcesController
;
end
class
ProductsController
<
ResourcesController
;
end
class
ImagesController
<
ResourcesController
;
end
class
PreferencesController
<
ResourcesController
;
end
module
Backoffice
class
ProductsController
<
ResourcesController
;
end
class
TagsController
<
ResourcesController
;
end
class
ManufacturersController
<
ResourcesController
;
end
class
ImagesController
<
ResourcesController
;
end
module
Admin
class
ProductsController
<
ResourcesController
;
end
class
ImagesController
<
ResourcesController
;
end
end
end
class
ResourcesTest
<
ActionController
::
TestCase
def
test_default_restful_routes
with_restful_routing
:messages
do
...
...
actionpack/test/dispatch/routing/concerns_test.rb
浏览文件 @
546497d0
require
'abstract_unit'
class
CommentsController
<
ActionController
::
Base
def
index
head
:ok
end
end
class
ImageAttachmentsController
<
ActionController
::
Base
def
index
head
:ok
end
end
class
RoutingConcernsTest
<
ActionDispatch
::
IntegrationTest
Routes
=
ActionDispatch
::
Routing
::
RouteSet
.
new
.
tap
do
|
app
|
app
.
draw
do
...
...
@@ -20,7 +8,7 @@ class RoutingConcernsTest < ActionDispatch::IntegrationTest
end
concern
:image_attachable
do
resources
:image
_attachment
s
,
only: :index
resources
:images
,
only: :index
end
resources
:posts
,
concerns:
[
:commentable
,
:image_attachable
]
do
...
...
@@ -65,13 +53,13 @@ def test_accessing_concern_from_nested_resources
end
def
test_accessing_concern_from_resources_with_more_than_one_concern
get
"/posts/1/image
_attachment
s"
get
"/posts/1/images"
assert_equal
"200"
,
@response
.
code
assert_equal
"/posts/1/image
_attachments"
,
post_image_attachment
s_path
(
post_id:
1
)
assert_equal
"/posts/1/image
s"
,
post_image
s_path
(
post_id:
1
)
end
def
test_accessing_concern_from_resources_using_only_option
get
"/posts/1/image
_attachment
/1"
get
"/posts/1/image/1"
assert_equal
"404"
,
@response
.
code
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录