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
1fa3f308
Commit
1fa3f308
authored
Oct 05, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Boards::Issues::ListService to list issues for a board list
parent
1a4b1e97
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
7 deletions
+28
-7
app/services/boards/issues/list_service.rb
app/services/boards/issues/list_service.rb
+4
-0
spec/services/boards/issues/list_service_spec.rb
spec/services/boards/issues/list_service_spec.rb
+24
-7
No files found.
app/services/boards/issues/list_service.rb
View file @
1fa3f308
...
@@ -10,6 +10,10 @@ module Boards
...
@@ -10,6 +10,10 @@ module Boards
private
private
def
board
@board
||=
project
.
boards
.
find
(
params
[
:board_id
])
end
def
list
def
list
@list
||=
board
.
lists
.
find
(
params
[
:id
])
@list
||=
board
.
lists
.
find
(
params
[
:id
])
end
end
...
...
spec/services/boards/issues/list_service_spec.rb
View file @
1fa3f308
...
@@ -4,7 +4,7 @@ describe Boards::Issues::ListService, services: true do
...
@@ -4,7 +4,7 @@ describe Boards::Issues::ListService, services: true do
describe
'#execute'
do
describe
'#execute'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project_with_board
)
}
let
(
:project
)
{
create
(
:project_with_board
)
}
let
(
:board
)
{
project
.
board
}
let
(
:board
)
{
create
(
:board
,
project:
project
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
name:
'Bug'
)
}
let
(
:bug
)
{
create
(
:label
,
project:
project
,
name:
'Bug'
)
}
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
...
@@ -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
)
{
project
.
board
.
backlog_list
}
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
)
{
project
.
board
.
done_list
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
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
])
}
...
@@ -37,7 +37,7 @@ describe Boards::Issues::ListService, services: true do
...
@@ -37,7 +37,7 @@ describe Boards::Issues::ListService, services: true do
end
end
it
'delegates search to IssuesFinder'
do
it
'delegates search to IssuesFinder'
do
params
=
{
id:
list1
.
id
}
params
=
{
board_id:
board
.
id
,
id:
list1
.
id
}
expect_any_instance_of
(
IssuesFinder
).
to
receive
(
:execute
).
once
.
and_call_original
expect_any_instance_of
(
IssuesFinder
).
to
receive
(
:execute
).
once
.
and_call_original
...
@@ -46,7 +46,7 @@ describe Boards::Issues::ListService, services: true do
...
@@ -46,7 +46,7 @@ describe Boards::Issues::ListService, services: true do
context
'sets default order to priority'
do
context
'sets default order to priority'
do
it
'returns opened issues when listing issues from Backlog'
do
it
'returns opened issues when listing issues from Backlog'
do
params
=
{
id:
backlog
.
id
}
params
=
{
board_id:
board
.
id
,
id:
backlog
.
id
}
issues
=
described_class
.
new
(
project
,
user
,
params
).
execute
issues
=
described_class
.
new
(
project
,
user
,
params
).
execute
...
@@ -54,7 +54,7 @@ describe Boards::Issues::ListService, services: true do
...
@@ -54,7 +54,7 @@ describe Boards::Issues::ListService, services: true do
end
end
it
'returns closed issues when listing issues from Done'
do
it
'returns closed issues when listing issues from Done'
do
params
=
{
id:
done
.
id
}
params
=
{
board_id:
board
.
id
,
id:
done
.
id
}
issues
=
described_class
.
new
(
project
,
user
,
params
).
execute
issues
=
described_class
.
new
(
project
,
user
,
params
).
execute
...
@@ -62,12 +62,29 @@ describe Boards::Issues::ListService, services: true do
...
@@ -62,12 +62,29 @@ describe Boards::Issues::ListService, services: true do
end
end
it
'returns opened issues that have label list applied when listing issues from a label list'
do
it
'returns opened issues that have label list applied when listing issues from a label list'
do
params
=
{
id:
list1
.
id
}
params
=
{
board_id:
board
.
id
,
id:
list1
.
id
}
issues
=
described_class
.
new
(
project
,
user
,
params
).
execute
issues
=
described_class
.
new
(
project
,
user
,
params
).
execute
expect
(
issues
).
to
eq
[
list1_issue3
,
list1_issue1
,
list1_issue2
]
expect
(
issues
).
to
eq
[
list1_issue3
,
list1_issue1
,
list1_issue2
]
end
end
end
end
context
'with list that does not belongs to the board'
do
it
'raises an error'
do
list
=
create
(
:list
)
service
=
described_class
.
new
(
project
,
user
,
board_id:
board
.
id
,
id:
list
.
id
)
expect
{
service
.
execute
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
end
context
'with invalid list id'
do
it
'raises an error'
do
service
=
described_class
.
new
(
project
,
user
,
board_id:
board
.
id
,
id:
nil
)
expect
{
service
.
execute
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
end
end
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