Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
5ef567e3
Commit
5ef567e3
authored
Jul 28, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does not allow Backlog/Done lists to be removed
parent
4180a15c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
15 deletions
+45
-15
app/services/boards/lists/destroy_service.rb
app/services/boards/lists/destroy_service.rb
+2
-0
spec/factories/lists.rb
spec/factories/lists.rb
+12
-0
spec/services/boards/lists/destroy_service_spec.rb
spec/services/boards/lists/destroy_service_spec.rb
+31
-15
No files found.
app/services/boards/lists/destroy_service.rb
View file @
5ef567e3
...
...
@@ -7,6 +7,8 @@ module Boards
end
def
execute
return
false
unless
list
.
label?
list
.
with_lock
do
reorder_higher_lists
remove_list
...
...
spec/factories/lists.rb
View file @
5ef567e3
...
...
@@ -4,4 +4,16 @@ FactoryGirl.define do
label
sequence
(
:position
)
end
factory
:backlog_list
,
parent: :list
do
list_type
:backlog
end
factory
:label_list
,
parent: :list
do
list_type
:label
end
factory
:done_list
,
parent: :list
do
list_type
:done
end
end
spec/services/boards/lists/destroy_service_spec.rb
View file @
5ef567e3
...
...
@@ -5,19 +5,20 @@ describe Boards::Lists::DestroyService, services: true do
let
(
:project
)
{
create
(
:project_with_board
)
}
let
(
:board
)
{
project
.
board
}
context
'when list type is label'
do
it
'removes list from board'
do
list
=
create
(
:
list
,
board:
board
)
list
=
create
(
:label_
list
,
board:
board
)
service
=
described_class
.
new
(
project
,
list_id:
list
.
id
)
expect
{
service
.
execute
}.
to
change
(
board
.
lists
,
:count
).
by
(
-
1
)
end
it
'decrements position of higher lists'
do
list1
=
create
(
:
list
,
board:
board
,
position:
1
)
list2
=
create
(
:
list
,
board:
board
,
position:
2
)
list3
=
create
(
:
list
,
board:
board
,
position:
3
)
list4
=
create
(
:
list
,
board:
board
,
position:
4
)
list5
=
create
(
:
list
,
board:
board
,
position:
5
)
list1
=
create
(
:backlog_
list
,
board:
board
,
position:
1
)
list2
=
create
(
:label_
list
,
board:
board
,
position:
2
)
list3
=
create
(
:label_
list
,
board:
board
,
position:
3
)
list4
=
create
(
:label_
list
,
board:
board
,
position:
4
)
list5
=
create
(
:done_
list
,
board:
board
,
position:
5
)
described_class
.
new
(
project
,
list_id:
list2
.
id
).
execute
...
...
@@ -27,4 +28,19 @@ describe Boards::Lists::DestroyService, services: true do
expect
(
list5
.
reload
.
position
).
to
eq
4
end
end
it
'does not remove list from board when list type is backlog'
do
list
=
create
(
:backlog_list
,
board:
board
)
service
=
described_class
.
new
(
project
,
list_id:
list
.
id
)
expect
{
service
.
execute
}.
not_to
change
(
board
.
lists
,
:count
)
end
it
'does not remove list from board when list type is done'
do
list
=
create
(
:done_list
,
board:
board
)
service
=
described_class
.
new
(
project
,
list_id:
list
.
id
)
expect
{
service
.
execute
}.
not_to
change
(
board
.
lists
,
:count
)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment