Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GitLab
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
projects.thm.de
GitLab
Commits
247e11c9
Commit
247e11c9
authored
Jul 27, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add service to create a board list
parent
a77aee93
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
0 deletions
+58
-0
app/services/boards/lists/create_service.rb
app/services/boards/lists/create_service.rb
+22
-0
spec/factories/boards.rb
spec/factories/boards.rb
+5
-0
spec/factories/lists.rb
spec/factories/lists.rb
+7
-0
spec/services/boards/lists/create_service_spec.rb
spec/services/boards/lists/create_service_spec.rb
+24
-0
No files found.
app/services/boards/lists/create_service.rb
0 → 100644
View file @
247e11c9
module
Boards
module
Lists
class
CreateService
def
initialize
(
project
,
params
=
{})
@board
=
project
.
board
@params
=
params
.
dup
end
def
execute
board
.
lists
.
create
(
params
.
merge
(
position:
position
))
end
private
attr_reader
:board
,
:params
def
position
board
.
lists
.
size
end
end
end
end
spec/factories/boards.rb
0 → 100644
View file @
247e11c9
FactoryGirl
.
define
do
factory
:board
do
project
factory: :empty_project
end
end
spec/factories/lists.rb
0 → 100644
View file @
247e11c9
FactoryGirl
.
define
do
factory
:list
do
board
label
sequence
(
:position
)
end
end
spec/services/boards/lists/create_service_spec.rb
0 → 100644
View file @
247e11c9
require
'spec_helper'
describe
Boards
::
Lists
::
CreateService
,
services:
true
do
describe
'#execute'
do
let
(
:project
)
{
create
(
:project_with_board
)
}
let
(
:board
)
{
project
.
board
}
let
(
:label
)
{
create
(
:label
,
name:
'in-progress'
)
}
it
'creates a new list for board'
do
service
=
described_class
.
new
(
project
,
label_id:
label
.
id
)
expect
{
service
.
execute
}.
to
change
(
board
.
lists
,
:count
).
by
(
1
)
end
it
'inserts the list to the end of lists'
do
create_list
(
:list
,
2
,
board:
board
)
service
=
described_class
.
new
(
project
,
label_id:
label
.
id
)
list
=
service
.
execute
expect
(
list
.
position
).
to
eq
2
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