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
b4b8e0ec
Commit
b4b8e0ec
authored
Oct 05, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Boards::ListService service to list project boards
parent
8b15e328
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
0 deletions
+51
-0
app/services/boards/list_service.rb
app/services/boards/list_service.rb
+14
-0
spec/services/boards/list_service_spec.rb
spec/services/boards/list_service_spec.rb
+37
-0
No files found.
app/services/boards/list_service.rb
0 → 100644
View file @
b4b8e0ec
module
Boards
class
ListService
<
Boards
::
BaseService
def
execute
create_board!
if
project
.
boards
.
empty?
project
.
boards
end
private
def
create_board!
Boards
::
CreateService
.
new
(
project
,
current_user
).
execute
end
end
end
spec/services/boards/list_service_spec.rb
0 → 100644
View file @
b4b8e0ec
require
'spec_helper'
describe
Boards
::
ListService
,
services:
true
do
describe
'#execute'
do
let
(
:project
)
{
create
(
:empty_project
)
}
subject
(
:service
)
{
described_class
.
new
(
project
,
double
)
}
context
'when project does not have a board'
do
it
'creates a new project board'
do
expect
{
service
.
execute
}.
to
change
(
project
.
boards
,
:count
).
by
(
1
)
end
it
'delegates the project board creation to Boards::CreateService'
do
expect_any_instance_of
(
Boards
::
CreateService
).
to
receive
(
:execute
).
once
service
.
execute
end
end
context
'when project has a board'
do
before
do
create
(
:board
,
project:
project
)
end
it
'does not create a new board'
do
expect
{
service
.
execute
}.
not_to
change
(
project
.
boards
,
:count
)
end
end
it
'returns project boards'
do
board
=
create
(
:board
,
project:
project
)
expect
(
service
.
execute
).
to
match_array
[
board
]
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