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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
c478202e
Commit
c478202e
authored
Jul 07, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This makes the `Boards::CreateService` more reusable for EE
parent
de2d5ce6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
app/services/boards/create_service.rb
app/services/boards/create_service.rb
+11
-8
spec/services/boards/create_service_spec.rb
spec/services/boards/create_service_spec.rb
+2
-0
No files found.
app/services/boards/create_service.rb
View file @
c478202e
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
.
lists
.
create
(
list_type: :backlog
)
board
.
lists
.
create
(
list_type: :closed
)
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 @
c478202e
...
...
@@ -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