Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
943a3734
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,发现更多精彩内容 >>
提交
943a3734
编写于
8月 12, 2011
作者:
A
Aaron Patterson
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
moving test_generate to an integration test with one assert per test
上级
c420ebf7
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
183 addition
and
108 deletion
+183
-108
actionpack/test/controller/routing_test.rb
actionpack/test/controller/routing_test.rb
+0
-108
actionpack/test/controller/url_for_integration_test.rb
actionpack/test/controller/url_for_integration_test.rb
+183
-0
未找到文件。
actionpack/test/controller/routing_test.rb
浏览文件 @
943a3734
...
...
@@ -1664,114 +1664,6 @@ def test_recognize_path
assert_raise
(
ActionController
::
RoutingError
)
{
@routes
.
recognize_path
(
'/none'
,
:method
=>
:get
)
}
end
def
test_generate
assert_equal
'/admin/users'
,
url_for
(
@routes
,
{
:use_route
=>
'admin_users'
})
assert_equal
'/admin/users'
,
url_for
(
@routes
,
{
:controller
=>
'admin/users'
})
assert_equal
'/admin/users'
,
url_for
(
@routes
,
{
:controller
=>
'admin/users'
,
:action
=>
'index'
})
assert_equal
'/admin/users'
,
url_for
(
@routes
,
{
:action
=>
'index'
},
{
:controller
=>
'admin/users'
})
assert_equal
'/admin/users'
,
url_for
(
@routes
,
{
:controller
=>
'users'
,
:action
=>
'index'
},
{
:controller
=>
'admin/accounts'
})
assert_equal
'/people'
,
url_for
(
@routes
,
{
:controller
=>
'/people'
,
:action
=>
'index'
},
{
:controller
=>
'admin/accounts'
})
assert_equal
'/admin/posts'
,
url_for
(
@routes
,
{
:controller
=>
'admin/posts'
})
assert_equal
'/admin/posts/new'
,
url_for
(
@routes
,
{
:controller
=>
'admin/posts'
,
:action
=>
'new'
})
assert_equal
'/blog/2009'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'show_date'
,
:year
=>
2009
})
assert_equal
'/blog/2009/1'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'show_date'
,
:year
=>
2009
,
:month
=>
1
})
assert_equal
'/blog/2009/1/1'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'show_date'
,
:year
=>
2009
,
:month
=>
1
,
:day
=>
1
})
assert_equal
'/archive/2010'
,
url_for
(
@routes
,
{
:controller
=>
'archive'
,
:action
=>
'index'
,
:year
=>
'2010'
})
assert_equal
'/archive'
,
url_for
(
@routes
,
{
:controller
=>
'archive'
,
:action
=>
'index'
})
assert_equal
'/archive?year=january'
,
url_for
(
@routes
,
{
:controller
=>
'archive'
,
:action
=>
'index'
,
:year
=>
'january'
})
assert_equal
'/people'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'index'
})
assert_equal
'/people'
,
url_for
(
@routes
,
{
:action
=>
'index'
},
{
:controller
=>
'people'
})
assert_equal
'/people'
,
url_for
(
@routes
,
{
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/people'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/people'
,
url_for
(
@routes
,
{},
{
:controller
=>
'people'
,
:action
=>
'index'
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'show'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/people/new'
,
url_for
(
@routes
,
{
:use_route
=>
'new_person'
})
assert_equal
'/people/new'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'new'
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{
:use_route
=>
'person'
,
:id
=>
'1'
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/people/1.xml'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
,
:format
=>
'xml'
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
1
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
Model
.
new
(
'1'
)
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{
:action
=>
'show'
,
:id
=>
'1'
},
{
:controller
=>
'people'
,
:action
=>
'index'
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{
:action
=>
'show'
,
:id
=>
1
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/people'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'index'
},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{},
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/people/1'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'show'
},
{
:controller
=>
'people'
,
:action
=>
'index'
,
:id
=>
'1'
})
assert_equal
'/people/1/edit'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'edit'
,
:id
=>
'1'
})
assert_equal
'/people/1/edit.xml'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'edit'
,
:id
=>
'1'
,
:format
=>
'xml'
})
assert_equal
'/people/1/edit'
,
url_for
(
@routes
,
{
:use_route
=>
'edit_person'
,
:id
=>
'1'
})
assert_equal
'/people/1?legacy=true'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
,
:legacy
=>
'true'
})
assert_equal
'/people?legacy=true'
,
url_for
(
@routes
,
{
:controller
=>
'people'
,
:action
=>
'index'
,
:legacy
=>
'true'
})
assert_equal
'/id_default/2'
,
url_for
(
@routes
,
{
:controller
=>
'foo'
,
:action
=>
'id_default'
,
:id
=>
'2'
})
assert_equal
'/id_default'
,
url_for
(
@routes
,
{
:controller
=>
'foo'
,
:action
=>
'id_default'
,
:id
=>
'1'
})
assert_equal
'/id_default'
,
url_for
(
@routes
,
{
:controller
=>
'foo'
,
:action
=>
'id_default'
,
:id
=>
1
})
assert_equal
'/id_default'
,
url_for
(
@routes
,
{
:controller
=>
'foo'
,
:action
=>
'id_default'
})
assert_equal
'/optional/bar'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'index'
,
:optional
=>
'bar'
})
assert_equal
'/posts'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'index'
})
assert_equal
'/project'
,
url_for
(
@routes
,
{
:controller
=>
'project'
,
:action
=>
'index'
})
assert_equal
'/projects/1'
,
url_for
(
@routes
,
{
:controller
=>
'project'
,
:action
=>
'index'
,
:project_id
=>
'1'
})
assert_equal
'/projects/1'
,
url_for
(
@routes
,
{
:controller
=>
'project'
,
:action
=>
'index'
},
{
:project_id
=>
'1'
})
assert_raise
(
ActionController
::
RoutingError
)
{
url_for
(
@routes
,
{
:use_route
=>
'project'
,
:controller
=>
'project'
,
:action
=>
'index'
})
}
assert_equal
'/projects/1'
,
url_for
(
@routes
,
{
:use_route
=>
'project'
,
:controller
=>
'project'
,
:action
=>
'index'
,
:project_id
=>
'1'
})
assert_equal
'/projects/1'
,
url_for
(
@routes
,
{
:use_route
=>
'project'
,
:controller
=>
'project'
,
:action
=>
'index'
},
{
:project_id
=>
'1'
})
assert_equal
'/clients'
,
url_for
(
@routes
,
{
:controller
=>
'projects'
,
:action
=>
'index'
})
assert_equal
'/clients?project_id=1'
,
url_for
(
@routes
,
{
:controller
=>
'projects'
,
:action
=>
'index'
,
:project_id
=>
'1'
})
assert_equal
'/clients'
,
url_for
(
@routes
,
{
:controller
=>
'projects'
,
:action
=>
'index'
},
{
:project_id
=>
'1'
})
assert_equal
'/clients'
,
url_for
(
@routes
,
{
:action
=>
'index'
},
{
:controller
=>
'projects'
,
:action
=>
'index'
,
:project_id
=>
'1'
})
assert_equal
'/comment/20'
,
url_for
(
@routes
,
{
:id
=>
20
},
{
:controller
=>
'comments'
,
:action
=>
'show'
})
assert_equal
'/comment/20'
,
url_for
(
@routes
,
{
:controller
=>
'comments'
,
:id
=>
20
,
:action
=>
'show'
})
assert_equal
'/comments/boo'
,
url_for
(
@routes
,
{
:controller
=>
'comments'
,
:action
=>
'boo'
})
assert_equal
'/ws/posts/show/1'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'show'
,
:id
=>
'1'
,
:ws
=>
true
})
assert_equal
'/ws/posts'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'index'
,
:ws
=>
true
})
assert_equal
'/account'
,
url_for
(
@routes
,
{
:controller
=>
'account'
,
:action
=>
'subscription'
})
assert_equal
'/account/billing'
,
url_for
(
@routes
,
{
:controller
=>
'account'
,
:action
=>
'billing'
})
assert_equal
'/pages/1/notes/show/1'
,
url_for
(
@routes
,
{
:page_id
=>
'1'
,
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/pages/1/notes/list'
,
url_for
(
@routes
,
{
:page_id
=>
'1'
,
:controller
=>
'notes'
,
:action
=>
'list'
})
assert_equal
'/pages/1/notes'
,
url_for
(
@routes
,
{
:page_id
=>
'1'
,
:controller
=>
'notes'
,
:action
=>
'index'
})
assert_equal
'/pages/1/notes'
,
url_for
(
@routes
,
{
:page_id
=>
'1'
,
:controller
=>
'notes'
})
assert_equal
'/notes'
,
url_for
(
@routes
,
{
:page_id
=>
nil
,
:controller
=>
'notes'
})
assert_equal
'/notes'
,
url_for
(
@routes
,
{
:controller
=>
'notes'
})
assert_equal
'/notes/print'
,
url_for
(
@routes
,
{
:controller
=>
'notes'
,
:action
=>
'print'
})
assert_equal
'/notes/print'
,
url_for
(
@routes
,
{},
{
:controller
=>
'notes'
,
:action
=>
'print'
})
assert_equal
'/notes/index/1'
,
url_for
(
@routes
,
{
:controller
=>
'notes'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
})
assert_equal
'/notes/index/1'
,
url_for
(
@routes
,
{
:controller
=>
'notes'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
,
:foo
=>
'bar'
})
assert_equal
'/notes/index/1'
,
url_for
(
@routes
,
{
:controller
=>
'notes'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
})
assert_equal
'/notes/index/1'
,
url_for
(
@routes
,
{
:action
=>
'index'
},
{
:controller
=>
'notes'
,
:id
=>
'1'
})
assert_equal
'/notes/index/1'
,
url_for
(
@routes
,
{},
{
:controller
=>
'notes'
,
:id
=>
'1'
})
assert_equal
'/notes/show/1'
,
url_for
(
@routes
,
{},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/notes/index/1'
,
url_for
(
@routes
,
{
:controller
=>
'notes'
,
:id
=>
'1'
},
{
:foo
=>
'bar'
})
assert_equal
'/posts'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/notes/list'
,
url_for
(
@routes
,
{
:action
=>
'list'
},
{
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/posts/ping'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'ping'
})
assert_equal
'/posts/show/1'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'show'
,
:id
=>
'1'
})
assert_equal
'/posts'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
})
assert_equal
'/posts'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:action
=>
'index'
})
assert_equal
'/posts'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
},
{
:controller
=>
'posts'
,
:action
=>
'index'
})
assert_equal
'/posts/create'
,
url_for
(
@routes
,
{
:action
=>
'create'
},
{
:controller
=>
'posts'
})
assert_equal
'/posts?foo=bar'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:foo
=>
'bar'
})
assert_equal
'/posts?foo%5B%5D=bar&foo%5B%5D=baz'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:foo
=>
[
'bar'
,
'baz'
]
})
assert_equal
'/posts?page=2'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:page
=>
2
})
assert_equal
'/posts?q%5Bfoo%5D%5Ba%5D=b'
,
url_for
(
@routes
,
{
:controller
=>
'posts'
,
:q
=>
{
:foo
=>
{
:a
=>
'b'
}}
})
assert_equal
'/news.rss'
,
url_for
(
@routes
,
{
:controller
=>
'news'
,
:action
=>
'index'
,
:format
=>
'rss'
})
assert_raise
(
ActionController
::
RoutingError
)
{
url_for
(
@routes
,
{
:action
=>
'index'
})
}
end
def
test_generate_extras
assert_equal
[
'/people'
,
[]],
@routes
.
generate_extras
(
:controller
=>
'people'
)
assert_equal
[
'/people'
,
[
:foo
]],
@routes
.
generate_extras
(
:controller
=>
'people'
,
:foo
=>
'bar'
)
...
...
actionpack/test/controller/url_for_integration_test.rb
0 → 100644
浏览文件 @
943a3734
# encoding: utf-8
require
'abstract_unit'
require
'controller/fake_controllers'
require
'active_support/core_ext/object/with_options'
module
RoutingTestHelpers
def
url_for
(
set
,
options
,
recall
=
nil
)
set
.
send
(
:url_for
,
options
.
merge
(
:only_path
=>
true
,
:_path_segments
=>
recall
))
end
end
module
ActionPack
class
URLForIntegrationTest
<
ActiveSupport
::
TestCase
include
RoutingTestHelpers
Model
=
Struct
.
new
(
:to_param
)
Mapping
=
lambda
{
namespace
:admin
do
resources
:users
,
:posts
end
namespace
'api'
do
root
:to
=>
'users#index'
end
match
'/blog(/:year(/:month(/:day)))'
=>
'posts#show_date'
,
:constraints
=>
{
:year
=>
/(19|20)\d\d/
,
:month
=>
/[01]?\d/
,
:day
=>
/[0-3]?\d/
},
:day
=>
nil
,
:month
=>
nil
match
'archive/:year'
,
:controller
=>
'archive'
,
:action
=>
'index'
,
:defaults
=>
{
:year
=>
nil
},
:constraints
=>
{
:year
=>
/\d{4}/
},
:as
=>
"blog"
resources
:people
#match 'legacy/people' => "people#index", :legacy => "true"
match
'symbols'
,
:controller
=>
:symbols
,
:action
=>
:show
,
:name
=>
:as_symbol
match
'id_default(/:id)'
=>
"foo#id_default"
,
:id
=>
1
match
'get_or_post'
=>
"foo#get_or_post"
,
:via
=>
[
:get
,
:post
]
match
'optional/:optional'
=>
"posts#index"
match
'projects/:project_id'
=>
"project#index"
,
:as
=>
"project"
match
'clients'
=>
"projects#index"
match
'ignorecase/geocode/:postalcode'
=>
'geocode#show'
,
:postalcode
=>
/hx\d\d-\d[a-z]{2}/i
match
'extended/geocode/:postalcode'
=>
'geocode#show'
,
:constraints
=>
{
:postalcode
=>
/# Postcode format
\d{5} #Prefix
(-\d{4})? #Suffix
/x
},
:as
=>
"geocode"
match
'news(.:format)'
=>
"news#index"
match
'comment/:id(/:action)'
=>
"comments#show"
match
'ws/:controller(/:action(/:id))'
,
:ws
=>
true
match
'account(/:action)'
=>
"account#subscription"
match
'pages/:page_id/:controller(/:action(/:id))'
match
':controller/ping'
,
:action
=>
'ping'
match
':controller(/:action(/:id))(.:format)'
root
:to
=>
"news#index"
}
def
setup
@routes
=
ActionDispatch
::
Routing
::
RouteSet
.
new
@routes
.
draw
(
&
Mapping
)
end
[
[
'/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/posts'
,[
{
:controller
=>
'admin/posts'
}]],
[
'/admin/posts/new'
,[
{
:controller
=>
'admin/posts'
,
:action
=>
'new'
}]],
[
'/blog/2009'
,[
{
:controller
=>
'posts'
,
:action
=>
'show_date'
,
:year
=>
2009
}]],
[
'/blog/2009/1'
,[
{
:controller
=>
'posts'
,
:action
=>
'show_date'
,
:year
=>
2009
,
:month
=>
1
}]],
[
'/blog/2009/1/1'
,[
{
:controller
=>
'posts'
,
:action
=>
'show_date'
,
:year
=>
2009
,
:month
=>
1
,
:day
=>
1
}]],
[
'/archive/2010'
,[
{
:controller
=>
'archive'
,
:action
=>
'index'
,
:year
=>
'2010'
}]],
[
'/archive'
,[
{
:controller
=>
'archive'
,
:action
=>
'index'
}]],
[
'/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/new'
,[
{
:use_route
=>
'new_person'
}]],
[
'/people/new'
,[
{
:controller
=>
'people'
,
:action
=>
'new'
}]],
[
'/people/1'
,[
{
:use_route
=>
'person'
,
:id
=>
'1'
}]],
[
'/people/1'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/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/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'
}]],
[
'/people/1?legacy=true'
,[
{
:controller
=>
'people'
,
:action
=>
'show'
,
:id
=>
'1'
,
:legacy
=>
'true'
}]],
[
'/people?legacy=true'
,[
{
:controller
=>
'people'
,
:action
=>
'index'
,
:legacy
=>
'true'
}]],
[
'/id_default/2'
,[
{
:controller
=>
'foo'
,
:action
=>
'id_default'
,
:id
=>
'2'
}]],
[
'/id_default'
,[
{
:controller
=>
'foo'
,
:action
=>
'id_default'
,
:id
=>
'1'
}]],
[
'/id_default'
,[
{
:controller
=>
'foo'
,
:action
=>
'id_default'
,
:id
=>
1
}]],
[
'/id_default'
,[
{
:controller
=>
'foo'
,
:action
=>
'id_default'
}]],
[
'/optional/bar'
,[
{
:controller
=>
'posts'
,
:action
=>
'index'
,
:optional
=>
'bar'
}]],
[
'/posts'
,[
{
:controller
=>
'posts'
,
:action
=>
'index'
}]],
[
'/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'
,[
{
:use_route
=>
'project'
,
:controller
=>
'project'
,
:action
=>
'index'
,
:project_id
=>
'1'
}]],
[
'/projects/1'
,[
{
:use_route
=>
'project'
,
:controller
=>
'project'
,
:action
=>
'index'
},
{
:project_id
=>
'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'
}]],
[
'/comment/20'
,[
{
:id
=>
20
},
{
:controller
=>
'comments'
,
:action
=>
'show'
}]],
[
'/comment/20'
,[
{
:controller
=>
'comments'
,
:id
=>
20
,
:action
=>
'show'
}]],
[
'/comments/boo'
,[
{
:controller
=>
'comments'
,
:action
=>
'boo'
}]],
[
'/ws/posts/show/1'
,[
{
:controller
=>
'posts'
,
:action
=>
'show'
,
:id
=>
'1'
,
:ws
=>
true
}]],
[
'/ws/posts'
,[
{
:controller
=>
'posts'
,
:action
=>
'index'
,
:ws
=>
true
}]],
[
'/account'
,[
{
:controller
=>
'account'
,
:action
=>
'subscription'
}]],
[
'/account/billing'
,[
{
:controller
=>
'account'
,
:action
=>
'billing'
}]],
[
'/pages/1/notes/show/1'
,[
{
:page_id
=>
'1'
,
:controller
=>
'notes'
,
:action
=>
'show'
,
:id
=>
'1'
}]],
[
'/pages/1/notes/list'
,[
{
:page_id
=>
'1'
,
:controller
=>
'notes'
,
:action
=>
'list'
}]],
[
'/pages/1/notes'
,[
{
:page_id
=>
'1'
,
:controller
=>
'notes'
,
:action
=>
'index'
}]],
[
'/pages/1/notes'
,[
{
:page_id
=>
'1'
,
:controller
=>
'notes'
}]],
[
'/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'
}]],
[
'/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?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
}]],
[
'/posts?q%5Bfoo%5D%5Ba%5D=b'
,
[{
:controller
=>
'posts'
,
:q
=>
{
:foo
=>
{
:a
=>
'b'
}}
}]],
[
'/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
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录