Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
97551e8d
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,发现更多精彩内容 >>
提交
97551e8d
编写于
9月 26, 2016
作者:
D
Douglas Barbosa Alexandre
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve project_with_board factory to create the default lists
上级
10d3696f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
23 addition
and
24 deletion
+23
-24
app/models/board.rb
app/models/board.rb
+8
-0
spec/controllers/projects/boards/lists_controller_spec.rb
spec/controllers/projects/boards/lists_controller_spec.rb
+0
-3
spec/factories/projects.rb
spec/factories/projects.rb
+2
-0
spec/features/boards/boards_spec.rb
spec/features/boards/boards_spec.rb
+1
-5
spec/services/boards/issues/list_service_spec.rb
spec/services/boards/issues/list_service_spec.rb
+2
-2
spec/services/boards/issues/move_service_spec.rb
spec/services/boards/issues/move_service_spec.rb
+2
-2
spec/services/boards/lists/create_service_spec.rb
spec/services/boards/lists/create_service_spec.rb
+2
-6
spec/services/boards/lists/destroy_service_spec.rb
spec/services/boards/lists/destroy_service_spec.rb
+4
-4
spec/services/boards/lists/move_service_spec.rb
spec/services/boards/lists/move_service_spec.rb
+2
-2
未找到文件。
app/models/board.rb
浏览文件 @
97551e8d
...
@@ -4,4 +4,12 @@ class Board < ActiveRecord::Base
...
@@ -4,4 +4,12 @@ class Board < ActiveRecord::Base
has_many
:lists
,
->
{
order
(
:list_type
,
:position
)
},
dependent: :delete_all
has_many
:lists
,
->
{
order
(
:list_type
,
:position
)
},
dependent: :delete_all
validates
:project
,
presence:
true
validates
:project
,
presence:
true
def
backlog_list
lists
.
merge
(
List
.
backlog
).
take
end
def
done_list
lists
.
merge
(
List
.
done
).
take
end
end
end
spec/controllers/projects/boards/lists_controller_spec.rb
浏览文件 @
97551e8d
...
@@ -20,10 +20,7 @@ describe Projects::Boards::ListsController do
...
@@ -20,10 +20,7 @@ describe Projects::Boards::ListsController do
end
end
it
'returns a list of board lists'
do
it
'returns a list of board lists'
do
board
=
project
.
create_board
create
(
:backlog_list
,
board:
board
)
create
(
:list
,
board:
board
)
create
(
:list
,
board:
board
)
create
(
:done_list
,
board:
board
)
read_board_list
user:
user
read_board_list
user:
user
...
...
spec/factories/projects.rb
浏览文件 @
97551e8d
...
@@ -106,6 +106,8 @@ FactoryGirl.define do
...
@@ -106,6 +106,8 @@ FactoryGirl.define do
factory
:project_with_board
,
parent: :empty_project
do
factory
:project_with_board
,
parent: :empty_project
do
after
(
:create
)
do
|
project
|
after
(
:create
)
do
|
project
|
project
.
create_board
project
.
create_board
project
.
board
.
lists
.
create
(
list_type: :backlog
)
project
.
board
.
lists
.
create
(
list_type: :done
)
end
end
end
end
end
end
spec/features/boards/boards_spec.rb
浏览文件 @
97551e8d
...
@@ -4,15 +4,11 @@ describe 'Issue Boards', feature: true, js: true do
...
@@ -4,15 +4,11 @@ describe 'Issue Boards', feature: true, js: true do
include
WaitForAjax
include
WaitForAjax
include
WaitForVueResource
include
WaitForVueResource
let
(
:project
)
{
create
(
:
empty_project
,
:public
)
}
let
(
:project
)
{
create
(
:
project_with_board
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:user2
)
{
create
(
:user
)
}
let!
(
:user2
)
{
create
(
:user
)
}
before
do
before
do
project
.
create_board
project
.
board
.
lists
.
create
(
list_type: :backlog
)
project
.
board
.
lists
.
create
(
list_type: :done
)
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user2
,
:master
]
project
.
team
<<
[
user2
,
:master
]
...
...
spec/services/boards/issues/list_service_spec.rb
浏览文件 @
97551e8d
...
@@ -13,10 +13,10 @@ describe Boards::Issues::ListService, services: true do
...
@@ -13,10 +13,10 @@ describe Boards::Issues::ListService, services: true do
let
(
:p2
)
{
create
(
:label
,
title:
'P2'
,
project:
project
,
priority:
2
)
}
let
(
:p2
)
{
create
(
:label
,
title:
'P2'
,
project:
project
,
priority:
2
)
}
let
(
:p3
)
{
create
(
:label
,
title:
'P3'
,
project:
project
,
priority:
3
)
}
let
(
:p3
)
{
create
(
:label
,
title:
'P3'
,
project:
project
,
priority:
3
)
}
let!
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
let!
(
:backlog
)
{
project
.
board
.
backlog_list
}
let!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
testing
,
position:
1
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
testing
,
position:
1
)
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
let!
(
:done
)
{
project
.
board
.
done_list
}
let!
(
:opened_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
])
}
let!
(
:opened_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
])
}
let!
(
:opened_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
p2
])
}
let!
(
:opened_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
p2
])
}
...
...
spec/services/boards/issues/move_service_spec.rb
浏览文件 @
97551e8d
...
@@ -10,10 +10,10 @@ describe Boards::Issues::MoveService, services: true do
...
@@ -10,10 +10,10 @@ describe Boards::Issues::MoveService, services: true do
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let
(
:testing
)
{
create
(
:label
,
project:
project
,
name:
'Testing'
)
}
let
(
:testing
)
{
create
(
:label
,
project:
project
,
name:
'Testing'
)
}
let!
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
let!
(
:backlog
)
{
project
.
board
.
backlog_list
}
let!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
testing
,
position:
1
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
testing
,
position:
1
)
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
let!
(
:done
)
{
project
.
board
.
done_list
}
before
do
before
do
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
:developer
]
...
...
spec/services/boards/lists/create_service_spec.rb
浏览文件 @
97551e8d
...
@@ -17,17 +17,15 @@ describe Boards::Lists::CreateService, services: true do
...
@@ -17,17 +17,15 @@ describe Boards::Lists::CreateService, services: true do
end
end
end
end
context
'when board lists has
only a backlog list
'
do
context
'when board lists has
backlog, and done lists
'
do
it
'creates a new list at beginning of the list'
do
it
'creates a new list at beginning of the list'
do
create
(
:backlog_list
,
board:
board
)
list
=
service
.
execute
list
=
service
.
execute
expect
(
list
.
position
).
to
eq
0
expect
(
list
.
position
).
to
eq
0
end
end
end
end
context
'when board lists has
only
labels lists'
do
context
'when board lists has labels lists'
do
it
'creates a new list at end of the lists'
do
it
'creates a new list at end of the lists'
do
create
(
:list
,
board:
board
,
position:
0
)
create
(
:list
,
board:
board
,
position:
0
)
create
(
:list
,
board:
board
,
position:
1
)
create
(
:list
,
board:
board
,
position:
1
)
...
@@ -40,8 +38,6 @@ describe Boards::Lists::CreateService, services: true do
...
@@ -40,8 +38,6 @@ describe Boards::Lists::CreateService, services: true do
context
'when board lists has backlog, label and done lists'
do
context
'when board lists has backlog, label and done lists'
do
it
'creates a new list at end of the label lists'
do
it
'creates a new list at end of the label lists'
do
create
(
:backlog_list
,
board:
board
)
create
(
:done_list
,
board:
board
)
list1
=
create
(
:list
,
board:
board
,
position:
0
)
list1
=
create
(
:list
,
board:
board
,
position:
0
)
list2
=
service
.
execute
list2
=
service
.
execute
...
...
spec/services/boards/lists/destroy_service_spec.rb
浏览文件 @
97551e8d
...
@@ -15,11 +15,11 @@ describe Boards::Lists::DestroyService, services: true do
...
@@ -15,11 +15,11 @@ describe Boards::Lists::DestroyService, services: true do
end
end
it
'decrements position of higher lists'
do
it
'decrements position of higher lists'
do
backlog
=
create
(
:backlog_list
,
board:
board
)
backlog
=
project
.
board
.
backlog_list
development
=
create
(
:list
,
board:
board
,
position:
0
)
development
=
create
(
:list
,
board:
board
,
position:
0
)
review
=
create
(
:list
,
board:
board
,
position:
1
)
review
=
create
(
:list
,
board:
board
,
position:
1
)
staging
=
create
(
:list
,
board:
board
,
position:
2
)
staging
=
create
(
:list
,
board:
board
,
position:
2
)
done
=
create
(
:done_list
,
board:
board
)
done
=
project
.
board
.
done_list
described_class
.
new
(
project
,
user
).
execute
(
development
)
described_class
.
new
(
project
,
user
).
execute
(
development
)
...
@@ -31,14 +31,14 @@ describe Boards::Lists::DestroyService, services: true do
...
@@ -31,14 +31,14 @@ describe Boards::Lists::DestroyService, services: true do
end
end
it
'does not remove list from board when list type is backlog'
do
it
'does not remove list from board when list type is backlog'
do
list
=
create
(
:backlog_list
,
board:
board
)
list
=
project
.
board
.
backlog_list
service
=
described_class
.
new
(
project
,
user
)
service
=
described_class
.
new
(
project
,
user
)
expect
{
service
.
execute
(
list
)
}.
not_to
change
(
board
.
lists
,
:count
)
expect
{
service
.
execute
(
list
)
}.
not_to
change
(
board
.
lists
,
:count
)
end
end
it
'does not remove list from board when list type is done'
do
it
'does not remove list from board when list type is done'
do
list
=
create
(
:done_list
,
board:
board
)
list
=
project
.
board
.
done_list
service
=
described_class
.
new
(
project
,
user
)
service
=
described_class
.
new
(
project
,
user
)
expect
{
service
.
execute
(
list
)
}.
not_to
change
(
board
.
lists
,
:count
)
expect
{
service
.
execute
(
list
)
}.
not_to
change
(
board
.
lists
,
:count
)
...
...
spec/services/boards/lists/move_service_spec.rb
浏览文件 @
97551e8d
...
@@ -6,12 +6,12 @@ describe Boards::Lists::MoveService, services: true do
...
@@ -6,12 +6,12 @@ describe Boards::Lists::MoveService, services: true do
let
(
:board
)
{
project
.
board
}
let
(
:board
)
{
project
.
board
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
let!
(
:backlog
)
{
project
.
board
.
backlog_list
}
let!
(
:planning
)
{
create
(
:list
,
board:
board
,
position:
0
)
}
let!
(
:planning
)
{
create
(
:list
,
board:
board
,
position:
0
)
}
let!
(
:development
)
{
create
(
:list
,
board:
board
,
position:
1
)
}
let!
(
:development
)
{
create
(
:list
,
board:
board
,
position:
1
)
}
let!
(
:review
)
{
create
(
:list
,
board:
board
,
position:
2
)
}
let!
(
:review
)
{
create
(
:list
,
board:
board
,
position:
2
)
}
let!
(
:staging
)
{
create
(
:list
,
board:
board
,
position:
3
)
}
let!
(
:staging
)
{
create
(
:list
,
board:
board
,
position:
3
)
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
let!
(
:done
)
{
project
.
board
.
done_list
}
context
'when list type is set to label'
do
context
'when list type is set to label'
do
it
'keeps position of lists when new position is nil'
do
it
'keeps position of lists when new position is nil'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录