Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
f3c1832a
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,发现更多精彩内容 >>
提交
f3c1832a
编写于
7月 02, 2014
作者:
A
Aaron Patterson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
stop passing recall to url_for
上级
8e105a55
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
37 deletion
+48
-37
actionpack/test/abstract_unit.rb
actionpack/test/abstract_unit.rb
+2
-2
actionpack/test/controller/url_for_integration_test.rb
actionpack/test/controller/url_for_integration_test.rb
+46
-35
未找到文件。
actionpack/test/abstract_unit.rb
浏览文件 @
f3c1832a
...
...
@@ -348,8 +348,8 @@ def patch(uri_or_host, path = nil)
end
module
RoutingTestHelpers
def
url_for
(
set
,
options
,
recall
=
{}
)
set
.
url_for
options
.
merge
(
:only_path
=>
true
,
:_recall
=>
recall
)
def
url_for
(
set
,
options
)
set
.
url_for
options
.
merge
(
:only_path
=>
true
)
end
def
make_set
(
strict
=
true
)
...
...
actionpack/test/controller/url_for_integration_test.rb
浏览文件 @
f3c1832a
...
...
@@ -6,6 +6,7 @@
module
ActionPack
class
URLForIntegrationTest
<
ActiveSupport
::
TestCase
include
RoutingTestHelpers
include
ActionDispatch
::
RoutingVerbs
Model
=
Struct
.
new
(
:to_param
)
...
...
@@ -61,8 +62,11 @@ class URLForIntegrationTest < ActiveSupport::TestCase
root
:to
=>
"news#index"
}
attr_reader
:routes
attr_accessor
:controller
def
setup
@routes
=
ActionDispatch
::
Routing
::
RouteSet
.
new
@routes
=
make_set
false
@routes
.
draw
(
&
Mapping
)
end
...
...
@@ -70,9 +74,9 @@ def setup
[
'/admin/users'
,[
{
:use_route
=>
'admin_users'
}]],
[
'/admin/users'
,[
{
:controller
=>
'admin/users'
}]],
[
'/admin/users'
,[
{
:controller
=>
'admin/users'
,
:action
=>
'index'
}]],
[
'/admin/users'
,[
{
:action
=>
'index'
},
{
:controller
=>
'admin/users'
}
]],
[
'/admin/users'
,[
{
:controller
=>
'users'
,
:action
=>
'index'
},
{
:controller
=>
'admin/accounts'
}
]],
[
'/people'
,[
{
:controller
=>
'/people'
,
:action
=>
'index'
},
{
:controller
=>
'admin/accounts'
}
]],
[
'/admin/users'
,[
{
:action
=>
'index'
},
{
:controller
=>
'admin/users'
,
:action
=>
'index'
},
'/admin/users'
]],
[
'/admin/users'
,[
{
:controller
=>
'users'
,
:action
=>
'index'
},
{
:controller
=>
'admin/accounts'
,
:action
=>
'show'
,
:id
=>
'1'
},
'/admin/accounts/show/1'
]],
[
'/people'
,[
{
:controller
=>
'/people'
,
:action
=>
'index'
},
{
:controller
=>
"admin/accounts"
,
:action
=>
"foo"
,
:id
=>
"bar"
},
'/admin/accounts/foo/bar'
]],
[
'/admin/posts'
,[
{
:controller
=>
'admin/posts'
}]],
[
'/admin/posts/new'
,[
{
:controller
=>
'admin/posts'
,
:action
=>
'new'
}]],
...
...
@@ -86,11 +90,11 @@ def setup
[
'/archive?year=january'
,[
{
:controller
=>
'archive'
,
:action
=>
'index'
,
:year
=>
'january'
}]],
[
'/people'
,[
{
:controller
=>
'people'
,
:action
=>
'index'
}]],
[
'/people'
,[
{
:action
=>
'index'
},
{
:controller
=>
'people'
}
]],
[
'/people'
,[
{
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/people'
,[
{
:controller
=>
'people'
,
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/people'
,[
{},
{
:controller
=>
'people'
,
:action
=>
'index'
}]],
[
'/people/1'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/people'
,[
{
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'index'
},
'/people'
]],
[
'/people'
,[
{
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}
,
'/people/show/1'
]],
[
'/people'
,[
{
:controller
=>
'people'
,
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}
,
'/people/show/1'
]],
[
'/people'
,[
{},
{
:controller
=>
'people'
,
:action
=>
'index'
}
,
'/people'
]],
[
'/people/1'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}
,
'/people/show/1'
]],
[
'/people/new'
,[
{
:use_route
=>
'new_person'
}]],
[
'/people/new'
,[
{
:controller
=>
'people'
,
:action
=>
'new'
}]],
[
'/people/1'
,[
{
:use_route
=>
'person'
,
:id
=>
'1'
}]],
...
...
@@ -98,11 +102,11 @@ def setup
[
'/people/1.xml'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
,
:format
=>
'xml'
}]],
[
'/people/1'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
1
}]],
[
'/people/1'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
Model
.
new
(
'1'
)
}]],
[
'/people/1'
,[
{
:action
=>
'show'
,
:id
=>
'1'
},
{
:controller
=>
'people'
,
:action
=>
'index'
}]],
[
'/people/1'
,[
{
:action
=>
'show'
,
:id
=>
1
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/people'
,[
{
:controller
=>
'people'
,
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/people/1'
,[
{},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/people/1'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
},
{
:controller
=>
'people'
,
:action
=>
'index'
,
:id
=>
'1'
}]],
[
'/people/1'
,[
{
:action
=>
'show'
,
:id
=>
'1'
},
{
:controller
=>
'people'
,
:action
=>
'index'
}
,
'/people'
]],
[
'/people/1'
,[
{
:action
=>
'show'
,
:id
=>
1
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}
,
'/people/show/1'
]],
[
'/people'
,[
{
:controller
=>
'people'
,
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}
,
'/people/show/1'
]],
[
'/people/1'
,[
{},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}
,
'/people/show/1'
]],
[
'/people/1'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
},
{
:controller
=>
'people'
,
:action
=>
'index'
,
:id
=>
'1'
}
,
'/people/index/1'
]],
[
'/people/1/edit'
,[
{
:controller
=>
'people'
,
:action
=>
'edit'
,
:id
=>
'1'
}]],
[
'/people/1/edit.xml'
,[
{
:controller
=>
'people'
,
:action
=>
'edit'
,
:id
=>
'1'
,
:format
=>
'xml'
}]],
[
'/people/1/edit'
,[
{
:use_route
=>
'edit_person'
,
:id
=>
'1'
}]],
...
...
@@ -118,16 +122,15 @@ def setup
[
'/project'
,[
{
:controller
=>
'project'
,
:action
=>
'index'
}]],
[
'/projects/1'
,[
{
:controller
=>
'project'
,
:action
=>
'index'
,
:project_id
=>
'1'
}]],
[
'/projects/1'
,[
{
:controller
=>
'project'
,
:action
=>
'index'
},
{
:project_id
=>
'1'
}
]],
[
'/projects/1'
,[
{
:controller
=>
'project'
,
:action
=>
'index'
},
{
:project_id
=>
'1'
,
:controller
=>
'project'
,
:action
=>
'index'
},
'/projects/1'
]],
[
'/projects/1'
,[
{
:use_route
=>
'project'
,
:controller
=>
'project'
,
:action
=>
'index'
,
:project_id
=>
'1'
}]],
[
'/projects/1'
,[
{
:use_route
=>
'project'
,
:controller
=>
'project'
,
:action
=>
'index'
},
{
:
project_id
=>
'1'
}
]],
[
'/projects/1'
,[
{
:use_route
=>
'project'
,
:controller
=>
'project'
,
:action
=>
'index'
},
{
:
controller
=>
'project'
,
:action
=>
'index'
,
:project_id
=>
'1'
},
'/projects/1'
]],
[
'/clients'
,[
{
:controller
=>
'projects'
,
:action
=>
'index'
}]],
[
'/clients?project_id=1'
,[
{
:controller
=>
'projects'
,
:action
=>
'index'
,
:project_id
=>
'1'
}]],
[
'/clients'
,[
{
:controller
=>
'projects'
,
:action
=>
'index'
},
{
:project_id
=>
'1'
}]],
[
'/clients'
,[
{
:action
=>
'index'
},
{
:controller
=>
'projects'
,
:action
=>
'index'
,
:project_id
=>
'1'
}]],
[
'/clients'
,[
{
:controller
=>
'projects'
,
:action
=>
'index'
},
{
:project_id
=>
'1'
,
:controller
=>
'project'
,
:action
=>
'index'
},
'/projects/1'
]],
[
'/comment/20'
,[
{
:id
=>
20
},
{
:controller
=>
'comments'
,
:action
=>
'show'
}]],
[
'/comment/20'
,[
{
:id
=>
20
},
{
:controller
=>
'comments'
,
:action
=>
'show'
}
,
'/comments/show'
]],
[
'/comment/20'
,[
{
:controller
=>
'comments'
,
:id
=>
20
,
:action
=>
'show'
}]],
[
'/comments/boo'
,[
{
:controller
=>
'comments'
,
:action
=>
'boo'
}]],
...
...
@@ -144,24 +147,21 @@ def setup
[
'/notes'
,[
{
:page_id
=>
nil
,
:controller
=>
'notes'
}]],
[
'/notes'
,[
{
:controller
=>
'notes'
}]],
[
'/notes/print'
,[
{
:controller
=>
'notes'
,
:action
=>
'print'
}]],
[
'/notes/print'
,[
{},
{
:controller
=>
'notes'
,
:action
=>
'print'
}]],
[
'/notes/index/1'
,[
{
:controller
=>
'notes'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
}]],
[
'/notes/index/1'
,[
{
:controller
=>
'notes'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
,
:foo
=>
'bar'
}]],
[
'/notes/index/1'
,[
{
:controller
=>
'notes'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
}]],
[
'/notes/index/1'
,[
{
:action
=>
'index'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
}]],
[
'/notes/index/1'
,[
{},
{
:controller
=>
'notes'
,
:id
=>
'1'
}]],
[
'/notes/show/1'
,[
{},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/notes/index/1'
,[
{
:controller
=>
'notes'
,
:id
=>
'1'
},
{
:foo
=>
'bar'
}]],
[
'/posts'
,[
{
:controller
=>
'posts'
},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/notes/list'
,[
{
:action
=>
'list'
},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/notes/print'
,[
{},
{
:controller
=>
'notes'
,
:action
=>
'print'
},
'/notes/print'
]],
[
'/notes/index/1'
,[
{
:controller
=>
'notes'
},
{
:controller
=>
'notes'
,
:action
=>
'index'
,
:id
=>
'1'
},
'/notes/index/1'
]],
[
'/notes/index/1'
,[
{
:controller
=>
'notes'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
,
:action
=>
'index'
},
'/notes/index/1'
]],
[
'/notes/index/1'
,[
{
:action
=>
'index'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
,
:action
=>
'index'
},
'/notes/index/1'
]],
[
'/notes/index/1'
,[
{},
{
:controller
=>
'notes'
,
:id
=>
'1'
,
:action
=>
'index'
},
'/notes/index/1'
]],
[
'/notes/show/1'
,[
{},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
},
'/notes/show/1'
]],
[
'/posts'
,[
{
:controller
=>
'posts'
},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
},
'/notes/show/1'
]],
[
'/notes/list'
,[
{
:action
=>
'list'
},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
},
'/notes/show/1'
]],
[
'/posts/ping'
,[
{
:controller
=>
'posts'
,
:action
=>
'ping'
}]],
[
'/posts/show/1'
,[
{
:controller
=>
'posts'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/posts'
,[
{
:controller
=>
'posts'
}]],
[
'/posts'
,[
{
:controller
=>
'posts'
,
:action
=>
'index'
}]],
[
'/posts'
,[
{
:controller
=>
'posts'
},
{
:controller
=>
'posts'
,
:action
=>
'index'
}]],
[
'/posts/create'
,[
{
:action
=>
'create'
},
{
:controller
=>
'posts'
}]],
[
'/posts/create'
,[
{
:action
=>
'create'
},
{
:day
=>
nil
,
:month
=>
nil
,
:controller
=>
"posts"
,
:action
=>
"show_date"
},
'/blog'
]],
[
'/posts?foo=bar'
,[
{
:controller
=>
'posts'
,
:foo
=>
'bar'
}]],
[
'/posts?foo%5B%5D=bar&foo%5B%5D=baz'
,
[{
:controller
=>
'posts'
,
:foo
=>
[
'bar'
,
'baz'
]
}]],
[
'/posts?page=2'
,
[{
:controller
=>
'posts'
,
:page
=>
2
}]],
...
...
@@ -169,9 +169,20 @@ def setup
[
'/news.rss'
,
[{
:controller
=>
'news'
,
:action
=>
'index'
,
:format
=>
'rss'
}]],
].
each_with_index
do
|
(
url
,
params
),
i
|
define_method
(
"test_
#{
url
.
gsub
(
/\W/
,
'_'
)
}
_
#{
i
}
"
)
do
assert_equal
url
,
url_for
(
@routes
,
*
params
),
params
.
inspect
end
if
params
.
length
>
1
hash
,
path_params
,
route
=
*
params
hash
[
:only_path
]
=
true
define_method
(
"test_
#{
url
.
gsub
(
/\W/
,
'_'
)
}
_
#{
i
}
"
)
do
get
URI
(
'http://test.host'
+
route
.
to_s
)
assert_equal
path_params
,
controller
.
request
.
path_parameters
assert_equal
url
,
controller
.
url_for
(
hash
),
params
.
inspect
end
else
define_method
(
"test_
#{
url
.
gsub
(
/\W/
,
'_'
)
}
_
#{
i
}
"
)
do
assert_equal
url
,
url_for
(
@routes
,
params
.
first
),
params
.
inspect
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录