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
Tatuya Kamada
gitlab-ce
Commits
860fafee
Commit
860fafee
authored
Jan 27, 2017
by
Douglas Barbosa Alexandre
Committed by
Fatih Acet
Feb 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove backlog lists from board services
parent
682d213f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
6 additions
and
88 deletions
+6
-88
app/services/boards/create_service.rb
app/services/boards/create_service.rb
+0
-1
spec/services/boards/create_service_spec.rb
spec/services/boards/create_service_spec.rb
+3
-4
spec/services/boards/issues/list_service_spec.rb
spec/services/boards/issues/list_service_spec.rb
+0
-13
spec/services/boards/issues/move_service_spec.rb
spec/services/boards/issues/move_service_spec.rb
+0
-49
spec/services/boards/lists/create_service_spec.rb
spec/services/boards/lists/create_service_spec.rb
+2
-2
spec/services/boards/lists/destroy_service_spec.rb
spec/services/boards/lists/destroy_service_spec.rb
+0
-9
spec/services/boards/lists/list_service_spec.rb
spec/services/boards/lists/list_service_spec.rb
+1
-1
spec/services/boards/lists/move_service_spec.rb
spec/services/boards/lists/move_service_spec.rb
+0
-9
No files found.
app/services/boards/create_service.rb
View file @
860fafee
...
@@ -12,7 +12,6 @@ module Boards
...
@@ -12,7 +12,6 @@ module Boards
def
create_board!
def
create_board!
board
=
project
.
boards
.
create
board
=
project
.
boards
.
create
board
.
lists
.
create
(
list_type: :backlog
)
board
.
lists
.
create
(
list_type: :done
)
board
.
lists
.
create
(
list_type: :done
)
board
board
...
...
spec/services/boards/create_service_spec.rb
View file @
860fafee
...
@@ -11,12 +11,11 @@ describe Boards::CreateService, services: true do
...
@@ -11,12 +11,11 @@ describe Boards::CreateService, services: true do
expect
{
service
.
execute
}.
to
change
(
Board
,
:count
).
by
(
1
)
expect
{
service
.
execute
}.
to
change
(
Board
,
:count
).
by
(
1
)
end
end
it
'creates default lists'
do
it
'creates
the
default lists'
do
board
=
service
.
execute
board
=
service
.
execute
expect
(
board
.
lists
.
size
).
to
eq
2
expect
(
board
.
lists
.
size
).
to
eq
1
expect
(
board
.
lists
.
first
).
to
be_backlog
expect
(
board
.
lists
.
first
).
to
be_done
expect
(
board
.
lists
.
last
).
to
be_done
end
end
end
end
...
...
spec/services/boards/issues/list_service_spec.rb
View file @
860fafee
...
@@ -13,15 +13,10 @@ describe Boards::Issues::ListService, services: true do
...
@@ -13,15 +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!
(
: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
)
{
create
(
:done_list
,
board:
board
)
}
let!
(
:opened_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
])
}
let!
(
:opened_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
p2
])
}
let!
(
:reopened_issue1
)
{
create
(
:issue
,
:reopened
,
project:
project
)
}
let!
(
:list1_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
p2
,
development
])
}
let!
(
:list1_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
p2
,
development
])
}
let!
(
:list1_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
])
}
let!
(
:list1_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
])
}
let!
(
:list1_issue3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
p1
])
}
let!
(
:list1_issue3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
development
,
p1
])
}
...
@@ -45,14 +40,6 @@ describe Boards::Issues::ListService, services: true do
...
@@ -45,14 +40,6 @@ describe Boards::Issues::ListService, services: true do
end
end
context
'sets default order to priority'
do
context
'sets default order to priority'
do
it
'returns opened issues when listing issues from Backlog'
do
params
=
{
board_id:
board
.
id
,
id:
backlog
.
id
}
issues
=
described_class
.
new
(
project
,
user
,
params
).
execute
expect
(
issues
).
to
eq
[
opened_issue2
,
reopened_issue1
,
opened_issue1
]
end
it
'returns closed issues when listing issues from Done'
do
it
'returns closed issues when listing issues from Done'
do
params
=
{
board_id:
board
.
id
,
id:
done
.
id
}
params
=
{
board_id:
board
.
id
,
id:
done
.
id
}
...
...
spec/services/boards/issues/move_service_spec.rb
View file @
860fafee
...
@@ -10,7 +10,6 @@ describe Boards::Issues::MoveService, services: true do
...
@@ -10,7 +10,6 @@ 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:
board1
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
board1
,
label:
development
,
position:
0
)
}
let!
(
:list1
)
{
create
(
:list
,
board:
board1
,
label:
development
,
position:
0
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board1
,
label:
testing
,
position:
1
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board1
,
label:
testing
,
position:
1
)
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board1
)
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board1
)
}
...
@@ -19,41 +18,6 @@ describe Boards::Issues::MoveService, services: true do
...
@@ -19,41 +18,6 @@ describe Boards::Issues::MoveService, services: true do
project
.
team
<<
[
user
,
:developer
]
project
.
team
<<
[
user
,
:developer
]
end
end
context
'when moving from backlog'
do
it
'adds the label of the list it goes to'
do
issue
=
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
])
params
=
{
board_id:
board1
.
id
,
from_list_id:
backlog
.
id
,
to_list_id:
list1
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
(
issue
)
expect
(
issue
.
reload
.
labels
).
to
contain_exactly
(
bug
,
development
)
end
end
context
'when moving to backlog'
do
it
'removes all list-labels'
do
issue
=
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
,
testing
])
params
=
{
board_id:
board1
.
id
,
from_list_id:
list1
.
id
,
to_list_id:
backlog
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
(
issue
)
expect
(
issue
.
reload
.
labels
).
to
contain_exactly
(
bug
)
end
end
context
'when moving from backlog to done'
do
it
'closes the issue'
do
issue
=
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
])
params
=
{
board_id:
board1
.
id
,
from_list_id:
backlog
.
id
,
to_list_id:
done
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
(
issue
)
issue
.
reload
expect
(
issue
.
labels
).
to
contain_exactly
(
bug
)
expect
(
issue
).
to
be_closed
end
end
context
'when moving an issue between lists'
do
context
'when moving an issue between lists'
do
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
])
}
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
])
}
let
(
:params
)
{
{
board_id:
board1
.
id
,
from_list_id:
list1
.
id
,
to_list_id:
list2
.
id
}
}
let
(
:params
)
{
{
board_id:
board1
.
id
,
from_list_id:
list1
.
id
,
to_list_id:
list2
.
id
}
}
...
@@ -113,19 +77,6 @@ describe Boards::Issues::MoveService, services: true do
...
@@ -113,19 +77,6 @@ describe Boards::Issues::MoveService, services: true do
end
end
end
end
context
'when moving from done to backlog'
do
it
'reopens the issue'
do
issue
=
create
(
:labeled_issue
,
:closed
,
project:
project
,
labels:
[
bug
])
params
=
{
board_id:
board1
.
id
,
from_list_id:
done
.
id
,
to_list_id:
backlog
.
id
}
described_class
.
new
(
project
,
user
,
params
).
execute
(
issue
)
issue
.
reload
expect
(
issue
.
labels
).
to
contain_exactly
(
bug
)
expect
(
issue
).
to
be_reopened
end
end
context
'when moving to same list'
do
context
'when moving to same list'
do
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
])
}
let
(
:issue
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
,
development
])
}
let
(
:params
)
{
{
board_id:
board1
.
id
,
from_list_id:
list1
.
id
,
to_list_id:
list1
.
id
}
}
let
(
:params
)
{
{
board_id:
board1
.
id
,
from_list_id:
list1
.
id
,
to_list_id:
list1
.
id
}
}
...
...
spec/services/boards/lists/create_service_spec.rb
View file @
860fafee
...
@@ -21,7 +21,7 @@ describe Boards::Lists::CreateService, services: true do
...
@@ -21,7 +21,7 @@ describe Boards::Lists::CreateService, services: true do
end
end
end
end
context
'when board lists has
backlog, and done lists
'
do
context
'when board lists has
the done list
'
do
it
'creates a new list at beginning of the list'
do
it
'creates a new list at beginning of the list'
do
list
=
service
.
execute
(
board
)
list
=
service
.
execute
(
board
)
...
@@ -40,7 +40,7 @@ describe Boards::Lists::CreateService, services: true do
...
@@ -40,7 +40,7 @@ describe Boards::Lists::CreateService, services: true do
end
end
end
end
context
'when board lists has
backlog,
label and done lists'
do
context
'when board lists has 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
list1
=
create
(
:list
,
board:
board
,
position:
0
)
list1
=
create
(
:list
,
board:
board
,
position:
0
)
...
...
spec/services/boards/lists/destroy_service_spec.rb
View file @
860fafee
...
@@ -15,7 +15,6 @@ describe Boards::Lists::DestroyService, services: true do
...
@@ -15,7 +15,6 @@ describe Boards::Lists::DestroyService, services: true do
end
end
it
'decrements position of higher lists'
do
it
'decrements position of higher lists'
do
backlog
=
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
)
...
@@ -23,20 +22,12 @@ describe Boards::Lists::DestroyService, services: true do
...
@@ -23,20 +22,12 @@ describe Boards::Lists::DestroyService, services: true do
described_class
.
new
(
project
,
user
).
execute
(
development
)
described_class
.
new
(
project
,
user
).
execute
(
development
)
expect
(
backlog
.
reload
.
position
).
to
be_nil
expect
(
review
.
reload
.
position
).
to
eq
0
expect
(
review
.
reload
.
position
).
to
eq
0
expect
(
staging
.
reload
.
position
).
to
eq
1
expect
(
staging
.
reload
.
position
).
to
eq
1
expect
(
done
.
reload
.
position
).
to
be_nil
expect
(
done
.
reload
.
position
).
to
be_nil
end
end
end
end
it
'does not remove list from board when list type is backlog'
do
list
=
board
.
backlog_list
service
=
described_class
.
new
(
project
,
user
)
expect
{
service
.
execute
(
list
)
}.
not_to
change
(
board
.
lists
,
:count
)
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
=
board
.
done_list
list
=
board
.
done_list
service
=
described_class
.
new
(
project
,
user
)
service
=
described_class
.
new
(
project
,
user
)
...
...
spec/services/boards/lists/list_service_spec.rb
View file @
860fafee
...
@@ -10,7 +10,7 @@ describe Boards::Lists::ListService, services: true do
...
@@ -10,7 +10,7 @@ describe Boards::Lists::ListService, services: true do
service
=
described_class
.
new
(
project
,
double
)
service
=
described_class
.
new
(
project
,
double
)
expect
(
service
.
execute
(
board
)).
to
eq
[
board
.
backlog_list
,
list
,
board
.
done_list
]
expect
(
service
.
execute
(
board
)).
to
eq
[
list
,
board
.
done_list
]
end
end
end
end
end
end
spec/services/boards/lists/move_service_spec.rb
View file @
860fafee
...
@@ -6,7 +6,6 @@ describe Boards::Lists::MoveService, services: true do
...
@@ -6,7 +6,6 @@ describe Boards::Lists::MoveService, services: true do
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
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
)
}
...
@@ -87,14 +86,6 @@ describe Boards::Lists::MoveService, services: true do
...
@@ -87,14 +86,6 @@ describe Boards::Lists::MoveService, services: true do
end
end
end
end
it
'keeps position of lists when list type is backlog'
do
service
=
described_class
.
new
(
project
,
user
,
position:
2
)
service
.
execute
(
backlog
)
expect
(
current_list_positions
).
to
eq
[
0
,
1
,
2
,
3
]
end
it
'keeps position of lists when list type is done'
do
it
'keeps position of lists when list type is done'
do
service
=
described_class
.
new
(
project
,
user
,
position:
2
)
service
=
described_class
.
new
(
project
,
user
,
position:
2
)
...
...
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