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
a77aee93
Commit
a77aee93
authored
Jul 27, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add service to create a new board for a project
parent
6e8d06a5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
0 deletions
+44
-0
app/services/boards/create_service.rb
app/services/boards/create_service.rb
+19
-0
spec/factories/projects.rb
spec/factories/projects.rb
+6
-0
spec/services/boards/create_service_spec.rb
spec/services/boards/create_service_spec.rb
+19
-0
No files found.
app/services/boards/create_service.rb
0 → 100644
View file @
a77aee93
module
Boards
class
CreateService
def
initialize
(
project
)
@project
=
project
end
def
execute
if
project
.
board
.
present?
project
.
board
else
project
.
create_board
end
end
private
attr_reader
:project
end
end
spec/factories/projects.rb
View file @
a77aee93
...
...
@@ -83,4 +83,10 @@ FactoryGirl.define do
)
end
end
factory
:project_with_board
,
parent: :empty_project
do
after
(
:create
)
do
|
project
|
project
.
create_board
end
end
end
spec/services/boards/create_service_spec.rb
0 → 100644
View file @
a77aee93
require
'spec_helper'
describe
Boards
::
CreateService
,
services:
true
do
describe
'#execute'
do
it
'creates a new board when project does not has one'
do
project
=
create
(
:empty_project
,
board:
nil
)
service
=
described_class
.
new
(
project
)
expect
{
service
.
execute
}.
to
change
(
Board
,
:count
).
by
(
1
)
end
it
'returns project board when project has one'
do
project
=
create
(
:project_with_board
)
service
=
described_class
.
new
(
project
)
expect
(
service
.
execute
).
to
eq
project
.
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