BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
dd180944
Commit
dd180944
authored
Jul 07, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bvl-backport-board-issue-create-service' into 'master'
This makes the `Boards::CreateService` more reusable for EE See merge request !12704
parents
939cff89
c478202e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
create_service.rb
app/services/boards/create_service.rb
+9
-6
create_service_spec.rb
spec/services/boards/create_service_spec.rb
+2
-0
No files found.
app/services/boards/create_service.rb
View file @
dd180944
module
Boards
class
CreateService
<
BaseService
def
execute
if
project
.
boards
.
empty?
create_board!
else
project
.
boards
.
first
end
create_board!
if
can_create_board?
end
private
def
can_create_board?
project
.
boards
.
size
==
0
end
def
create_board!
board
=
project
.
boards
.
create
board
=
project
.
boards
.
create
(
params
)
if
board
.
persisted?
board
.
lists
.
create
(
list_type: :backlog
)
board
.
lists
.
create
(
list_type: :closed
)
end
board
end
...
...
spec/services/boards/create_service_spec.rb
View file @
dd180944
...
...
@@ -26,6 +26,8 @@ describe Boards::CreateService, services: true do
end
it
'does not create a new board'
do
expect
(
service
).
to
receive
(
:can_create_board?
)
{
false
}
expect
{
service
.
execute
}.
not_to
change
(
project
.
boards
,
:count
)
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