Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
74d2085c
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
74d2085c
编写于
3月 09, 2014
作者:
R
Robert Speicher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Sort tag names using VersionSorter
上级
a37c6794
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
40 addition
and
3 deletion
+40
-3
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+2
-3
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+38
-0
未找到文件。
app/helpers/application_helper.rb
浏览文件 @
74d2085c
...
...
@@ -94,11 +94,10 @@ module ApplicationHelper
options
=
[
[
"Branches"
,
repository
.
branch_names
],
[
"Tags"
,
repository
.
tag_names
]
[
"Tags"
,
VersionSorter
.
rsort
(
repository
.
tag_names
)
]
]
# If reference is commit id -
# we should add it to branch/tag selectbox
# If reference is commit id - we should add it to branch/tag selectbox
if
(
@ref
&&
!
options
.
flatten
.
include?
(
@ref
)
&&
@ref
=~
/^[0-9a-zA-Z]{6,52}$/
)
options
<<
[
"Commit"
,
[
@ref
]]
...
...
spec/helpers/application_helper_spec.rb
浏览文件 @
74d2085c
...
...
@@ -116,7 +116,45 @@ describe ApplicationHelper do
allow
(
self
).
to
receive
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
gravatar_icon
(
user_email
).
should
==
gravatar_icon
(
user_email
.
upcase
+
" "
)
end
end
describe
"grouped_options_refs"
do
# Override Rails' grouped_options_for_select helper since HTML is harder to work with
def
grouped_options_for_select
(
options
,
*
args
)
options
end
let
(
:options
)
{
grouped_options_refs
}
before
do
# Must be an instance variable
@project
=
create
(
:project
)
end
it
"includes a list of branch names"
do
options
[
0
][
0
].
should
==
'Branches'
options
[
0
][
1
].
should
include
(
'master'
,
'stable'
)
end
it
"includes a list of tag names"
do
options
[
1
][
0
].
should
==
'Tags'
options
[
1
][
1
].
should
include
(
'v0.9.4'
,
'v1.2.0'
)
end
it
"includes a specific commit ref if defined"
do
# Must be an instance variable
@ref
=
'2ed06dc41dbb5936af845b87d79e05bbf24c73b8'
options
[
2
][
0
].
should
==
'Commit'
options
[
2
][
1
].
should
==
[
@ref
]
end
it
"sorts tags in a natural order"
do
# Stub repository.tag_names to make sure we get some valid testing data
expect
(
@project
.
repository
).
to
receive
(
:tag_names
).
and_return
([
"v1.0.9"
,
"v1.0.10"
,
"v2.0"
,
"v3.1.4.2"
,
"v1.0.9a"
])
options
[
1
][
1
].
should
==
[
"v3.1.4.2"
,
"v2.0"
,
"v1.0.10"
,
"v1.0.9a"
,
"v1.0.9"
]
end
end
describe
"user_color_scheme_class"
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录