Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
941516f2
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,发现更多精彩内容 >>
提交
941516f2
编写于
11月 21, 2013
作者:
Y
Yves Senn
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12975 from sbagdat/fix-for-rake-routes
Fix for routes task
上级
7ae22cda
6701b4cf
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
19 deletion
+24
-19
actionpack/CHANGELOG.md
actionpack/CHANGELOG.md
+4
-0
actionpack/lib/action_dispatch/routing/inspector.rb
actionpack/lib/action_dispatch/routing/inspector.rb
+2
-1
actionpack/test/dispatch/routing/inspector_test.rb
actionpack/test/dispatch/routing/inspector_test.rb
+16
-16
railties/test/application/rake_test.rb
railties/test/application/rake_test.rb
+2
-2
未找到文件。
actionpack/CHANGELOG.md
浏览文件 @
941516f2
*
Fix formatting for
`rake routes`
when a section is shorter than a header
*Sıtkı Bağdat*
*
Take a hash with options inside array in #url_for
Example:
...
...
actionpack/lib/action_dispatch/routing/inspector.rb
浏览文件 @
941516f2
...
...
@@ -179,7 +179,8 @@ def no_routes
private
def
draw_section
(
routes
)
name_width
,
verb_width
,
path_width
=
widths
(
routes
)
header_lengths
=
[
'Prefix'
,
'Verb'
,
'URI Pattern'
].
map
(
&
:length
)
name_width
,
verb_width
,
path_width
=
widths
(
routes
).
zip
(
header_lengths
).
map
(
&
:max
)
routes
.
map
do
|
r
|
"
#{
r
[
:name
].
rjust
(
name_width
)
}
#{
r
[
:verb
].
ljust
(
verb_width
)
}
#{
r
[
:path
].
ljust
(
path_width
)
}
#{
r
[
:reqs
]
}
"
...
...
actionpack/test/dispatch/routing/inspector_test.rb
浏览文件 @
941516f2
...
...
@@ -46,8 +46,8 @@ def self.inspect
assert_equal
[
" Prefix Verb URI Pattern Controller#Action"
,
"custom_assets GET /custom/assets(.:format) custom_assets#show"
,
" blog /blog Blog::Engine"
,
"custom_assets GET
/custom/assets(.:format) custom_assets#show"
,
" blog
/blog Blog::Engine"
,
""
,
"Routes for Blog::Engine:"
,
"cart GET /cart(.:format) cart#show"
...
...
@@ -61,7 +61,7 @@ def test_cart_inspect
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"cart
GET
/cart(.:format) cart#show"
"cart
GET
/cart(.:format) cart#show"
],
output
end
...
...
@@ -72,7 +72,7 @@ def test_inspect_shows_custom_assets
assert_equal
[
" Prefix Verb URI Pattern Controller#Action"
,
"custom_assets GET /custom/assets(.:format) custom_assets#show"
"custom_assets GET
/custom/assets(.:format) custom_assets#show"
],
output
end
...
...
@@ -101,7 +101,7 @@ def test_inspect_routes_shows_root_route
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"
root GET /
pages#main"
"
root GET /
pages#main"
],
output
end
...
...
@@ -112,7 +112,7 @@ def test_inspect_routes_shows_dynamic_action_route
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"
GET
/api/:action(.:format) api#:action"
"
GET
/api/:action(.:format) api#:action"
],
output
end
...
...
@@ -123,7 +123,7 @@ def test_inspect_routes_shows_controller_and_action_only_route
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"
GET
/:controller/:action(.:format) :controller#:action"
"
GET
/:controller/:action(.:format) :controller#:action"
],
output
end
...
...
@@ -134,7 +134,7 @@ def test_inspect_routes_shows_controller_and_action_route_with_constraints
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"
GET
/:controller(/:action(/:id))(.:format) :controller#:action {:id=>/
\\
d+/}"
"
GET
/:controller(/:action(/:id))(.:format) :controller#:action {:id=>/
\\
d+/}"
],
output
end
...
...
@@ -145,7 +145,7 @@ def test_rake_routes_shows_route_with_defaults
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
%Q[
GET
/photos/:id(.:format) photos#show {:format=>"jpg"}]
%Q[
GET
/photos/:id(.:format) photos#show {:format=>"jpg"}]
],
output
end
...
...
@@ -156,7 +156,7 @@ def test_rake_routes_shows_route_with_constraints
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"
GET
/photos/:id(.:format) photos#show {:id=>/[A-Z]
\\
d{5}/}"
"
GET
/photos/:id(.:format) photos#show {:id=>/[A-Z]
\\
d{5}/}"
],
output
end
...
...
@@ -172,7 +172,7 @@ def test_rake_routes_shows_route_with_rack_app
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"
GET
/foo/:id(.:format)
#{
RackApp
.
name
}
{:id=>/[A-Z]
\\
d{5}/}"
"
GET
/foo/:id(.:format)
#{
RackApp
.
name
}
{:id=>/[A-Z]
\\
d{5}/}"
],
output
end
...
...
@@ -191,7 +191,7 @@ def inspect
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"
/foo
#{
RackApp
.
name
}
{:constraint=>( my custom constraint )}"
"
/foo
#{
RackApp
.
name
}
{:constraint=>( my custom constraint )}"
],
output
end
...
...
@@ -212,9 +212,9 @@ def test_redirect
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
" foo GET /foo(.:format) redirect(301, /foo/bar) {:subdomain=>
\"
admin
\"
}"
,
" bar GET /bar(.:format) redirect(307, path: /foo/bar)"
,
"foobar GET /foobar(.:format) redirect(301)"
" foo GET
/foo(.:format) redirect(301, /foo/bar) {:subdomain=>
\"
admin
\"
}"
,
" bar GET
/bar(.:format) redirect(307, path: /foo/bar)"
,
"foobar GET
/foobar(.:format) redirect(301)"
],
output
end
...
...
@@ -241,7 +241,7 @@ def test_regression_route_with_controller_regexp
end
assert_equal
[
"Prefix Verb URI Pattern Controller#Action"
,
"
GET
/:controller(/:action) (?-mix:api
\\
/[^
\\
/]+)#:action"
],
output
"
GET
/:controller(/:action) (?-mix:api
\\
/[^
\\
/]+)#:action"
],
output
end
end
end
...
...
railties/test/application/rake_test.rb
浏览文件 @
941516f2
...
...
@@ -111,7 +111,7 @@ def test_rake_routes_calls_the_route_inspector
RUBY
output
=
Dir
.
chdir
(
app_path
){
`rake routes`
}
assert_equal
"Prefix Verb URI Pattern Controller#Action
\n
cart
GET
/cart(.:format) cart#show
\n
"
,
output
assert_equal
"Prefix Verb URI Pattern Controller#Action
\n
cart
GET
/cart(.:format) cart#show
\n
"
,
output
end
def
test_rake_routes_with_controller_environment
...
...
@@ -124,7 +124,7 @@ def test_rake_routes_with_controller_environment
ENV
[
'CONTROLLER'
]
=
'cart'
output
=
Dir
.
chdir
(
app_path
){
`rake routes`
}
assert_equal
"Prefix Verb URI Pattern Controller#Action
\n
cart
GET
/cart(.:format) cart#show
\n
"
,
output
assert_equal
"Prefix Verb URI Pattern Controller#Action
\n
cart
GET
/cart(.:format) cart#show
\n
"
,
output
end
def
test_rake_routes_displays_message_when_no_routes_are_defined
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录