Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
2e622553
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,发现更多精彩内容 >>
提交
2e622553
编写于
7月 12, 2019
作者:
W
Winnie Hellmann
提交者:
Jan Provaznik
7月 12, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split and prepend CurrentBoardEntity
(cherry picked from commit 1e8bdd01bff96122fe80c51fa8f024f18675b58b)
上级
4c6bdd23
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
46 addition
and
3 deletion
+46
-3
app/helpers/boards_helper.rb
app/helpers/boards_helper.rb
+5
-1
app/serializers/current_board_entity.rb
app/serializers/current_board_entity.rb
+6
-0
app/serializers/current_board_serializer.rb
app/serializers/current_board_serializer.rb
+5
-0
spec/fixtures/api/schemas/current-board.json
spec/fixtures/api/schemas/current-board.json
+16
-0
spec/helpers/boards_helper_spec.rb
spec/helpers/boards_helper_spec.rb
+14
-2
未找到文件。
app/helpers/boards_helper.rb
浏览文件 @
2e622553
...
@@ -99,7 +99,11 @@ module BoardsHelper
...
@@ -99,7 +99,11 @@ module BoardsHelper
recent_project_boards_path
(
@project
)
if
current_board_parent
.
is_a?
(
Project
)
recent_project_boards_path
(
@project
)
if
current_board_parent
.
is_a?
(
Project
)
end
end
def
serializer
CurrentBoardSerializer
.
new
end
def
current_board_json
def
current_board_json
board
.
to
_json
serializer
.
represent
(
board
).
as
_json
end
end
end
end
app/serializers/current_board_entity.rb
0 → 100644
浏览文件 @
2e622553
# frozen_string_literal: true
class
CurrentBoardEntity
<
Grape
::
Entity
expose
:id
expose
:name
end
app/serializers/current_board_serializer.rb
0 → 100644
浏览文件 @
2e622553
# frozen_string_literal: true
class
CurrentBoardSerializer
<
BaseSerializer
entity
CurrentBoardEntity
end
spec/fixtures/api/schemas/current-board.json
0 → 100644
浏览文件 @
2e622553
{
"type"
:
"object"
,
"allOf"
:
[
{
"$ref"
:
"board.json"
},
{
"required"
:
[
"id"
,
"name"
],
"properties"
:
{
"id"
:
{
"type"
:
"integer"
},
"name"
:
{
"type"
:
"string"
}
}
}
]
}
spec/helpers/boards_helper_spec.rb
浏览文件 @
2e622553
require
'spec_helper'
require
'spec_helper'
describe
BoardsHelper
do
describe
BoardsHelper
do
set
(
:project
)
{
create
(
:project
)
}
describe
'#build_issue_link_base'
do
describe
'#build_issue_link_base'
do
context
'project board'
do
context
'project board'
do
it
'returns correct path for project board'
do
it
'returns correct path for project board'
do
@project
=
create
(
:project
)
@project
=
project
@board
=
create
(
:board
,
project:
@project
)
@board
=
create
(
:board
,
project:
@project
)
expect
(
build_issue_link_base
).
to
eq
(
"/
#{
@project
.
namespace
.
path
}
/
#{
@project
.
path
}
/issues"
)
expect
(
build_issue_link_base
).
to
eq
(
"/
#{
@project
.
namespace
.
path
}
/
#{
@project
.
path
}
/issues"
)
...
@@ -31,7 +33,6 @@ describe BoardsHelper do
...
@@ -31,7 +33,6 @@ describe BoardsHelper do
describe
'#board_data'
do
describe
'#board_data'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
before
do
before
do
...
@@ -46,4 +47,15 @@ describe BoardsHelper do
...
@@ -46,4 +47,15 @@ describe BoardsHelper do
expect
(
helper
.
board_data
[
:lists_endpoint
]).
to
eq
(
board_lists_path
(
board
))
expect
(
helper
.
board_data
[
:lists_endpoint
]).
to
eq
(
board_lists_path
(
board
))
end
end
end
end
describe
'#current_board_json'
do
let
(
:board_json
)
{
helper
.
current_board_json
}
it
'can serialise with a basic set of attributes'
do
board
=
create
(
:board
,
project:
project
)
assign
(
:board
,
board
)
expect
(
board_json
).
to
match_schema
(
'current-board'
)
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录