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
Léo-Paul Géneau
gitlab-ce
Commits
97551e8d
Commit
97551e8d
authored
Sep 26, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve project_with_board factory to create the default lists
parent
10d3696f
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
23 additions
and
24 deletions
+23
-24
app/models/board.rb
app/models/board.rb
+8
-0
spec/controllers/projects/boards/lists_controller_spec.rb
spec/controllers/projects/boards/lists_controller_spec.rb
+0
-3
spec/factories/projects.rb
spec/factories/projects.rb
+2
-0
spec/features/boards/boards_spec.rb
spec/features/boards/boards_spec.rb
+1
-5
spec/services/boards/issues/list_service_spec.rb
spec/services/boards/issues/list_service_spec.rb
+2
-2
spec/services/boards/issues/move_service_spec.rb
spec/services/boards/issues/move_service_spec.rb
+2
-2
spec/services/boards/lists/create_service_spec.rb
spec/services/boards/lists/create_service_spec.rb
+2
-6
spec/services/boards/lists/destroy_service_spec.rb
spec/services/boards/lists/destroy_service_spec.rb
+4
-4
spec/services/boards/lists/move_service_spec.rb
spec/services/boards/lists/move_service_spec.rb
+2
-2
No files found.
app/models/board.rb
View file @
97551e8d
...
...
@@ -4,4 +4,12 @@ class Board < ActiveRecord::Base
has_many
:lists
,
->
{
order
(
:list_type
,
:position
)
},
dependent: :delete_all
validates
:project
,
presence:
true
def
backlog_list
lists
.
merge
(
List
.
backlog
).
take
end
def
done_list
lists
.
merge
(
List
.
done
).
take
end
end
spec/controllers/projects/boards/lists_controller_spec.rb
View file @
97551e8d
...
...
@@ -20,10 +20,7 @@ describe Projects::Boards::ListsController do
end
it
'returns a list of board lists'
do
board
=
project
.
create_board
create
(
:backlog_list
,
board:
board
)
create
(
:list
,
board:
board
)
create
(
:done_list
,
board:
board
)
read_board_list
user:
user
...
...
spec/factories/projects.rb
View file @
97551e8d
...
...
@@ -106,6 +106,8 @@ FactoryGirl.define do
factory
:project_with_board
,
parent: :empty_project
do
after
(
:create
)
do
|
project
|
project
.
create_board
project
.
board
.
lists
.
create
(
list_type: :backlog
)
project
.
board
.
lists
.
create
(
list_type: :done
)
end
end
end
spec/features/boards/boards_spec.rb
View file @
97551e8d
...
...
@@ -4,15 +4,11 @@ describe 'Issue Boards', feature: true, js: true do
include
WaitForAjax
include
WaitForVueResource
let
(
:project
)
{
create
(
:
empty_project
,
:public
)
}
let
(
:project
)
{
create
(
:
project_with_board
,
:public
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:user2
)
{
create
(
:user
)
}
before
do
project
.
create_board
project
.
board
.
lists
.
create
(
list_type: :backlog
)
project
.
board
.
lists
.
create
(
list_type: :done
)
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user2
,
:master
]
...
...
spec/services/boards/issues/list_service_spec.rb
View file @
97551e8d
...
...
@@ -13,10 +13,10 @@ describe Boards::Issues::ListService, services: true do
let
(
:p2
)
{
create
(
:label
,
title:
'P2'
,
project:
project
,
priority:
2
)
}
let
(
:p3
)
{
create
(
:label
,
title:
'P3'
,
project:
project
,
priority:
3
)
}
let!
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
let!
(
:backlog
)
{
project
.
board
.
backlog_list
}
let!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
testing
,
position:
1
)
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
let!
(
:done
)
{
project
.
board
.
done_list
}
let!
(
:opened_issue1
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
bug
])
}
let!
(
:opened_issue2
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
p2
])
}
...
...
spec/services/boards/issues/move_service_spec.rb
View file @
97551e8d
...
...
@@ -10,10 +10,10 @@ describe Boards::Issues::MoveService, services: true do
let
(
:development
)
{
create
(
:label
,
project:
project
,
name:
'Development'
)
}
let
(
:testing
)
{
create
(
:label
,
project:
project
,
name:
'Testing'
)
}
let!
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
let!
(
:backlog
)
{
project
.
board
.
backlog_list
}
let!
(
:list1
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
0
)
}
let!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
testing
,
position:
1
)
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
let!
(
:done
)
{
project
.
board
.
done_list
}
before
do
project
.
team
<<
[
user
,
:developer
]
...
...
spec/services/boards/lists/create_service_spec.rb
View file @
97551e8d
...
...
@@ -17,17 +17,15 @@ describe Boards::Lists::CreateService, services: true do
end
end
context
'when board lists has
only a backlog list
'
do
context
'when board lists has
backlog, and done lists
'
do
it
'creates a new list at beginning of the list'
do
create
(
:backlog_list
,
board:
board
)
list
=
service
.
execute
expect
(
list
.
position
).
to
eq
0
end
end
context
'when board lists has
only
labels lists'
do
context
'when board lists has labels lists'
do
it
'creates a new list at end of the lists'
do
create
(
:list
,
board:
board
,
position:
0
)
create
(
:list
,
board:
board
,
position:
1
)
...
...
@@ -40,8 +38,6 @@ describe Boards::Lists::CreateService, services: true do
context
'when board lists has backlog, label and done lists'
do
it
'creates a new list at end of the label lists'
do
create
(
:backlog_list
,
board:
board
)
create
(
:done_list
,
board:
board
)
list1
=
create
(
:list
,
board:
board
,
position:
0
)
list2
=
service
.
execute
...
...
spec/services/boards/lists/destroy_service_spec.rb
View file @
97551e8d
...
...
@@ -15,11 +15,11 @@ describe Boards::Lists::DestroyService, services: true do
end
it
'decrements position of higher lists'
do
backlog
=
create
(
:backlog_list
,
board:
board
)
backlog
=
project
.
board
.
backlog_list
development
=
create
(
:list
,
board:
board
,
position:
0
)
review
=
create
(
:list
,
board:
board
,
position:
1
)
staging
=
create
(
:list
,
board:
board
,
position:
2
)
done
=
create
(
:done_list
,
board:
board
)
done
=
project
.
board
.
done_list
described_class
.
new
(
project
,
user
).
execute
(
development
)
...
...
@@ -31,14 +31,14 @@ describe Boards::Lists::DestroyService, services: true do
end
it
'does not remove list from board when list type is backlog'
do
list
=
create
(
:backlog_list
,
board:
board
)
list
=
project
.
board
.
backlog_list
service
=
described_class
.
new
(
project
,
user
)
expect
{
service
.
execute
(
list
)
}.
not_to
change
(
board
.
lists
,
:count
)
end
it
'does not remove list from board when list type is done'
do
list
=
create
(
:done_list
,
board:
board
)
list
=
project
.
board
.
done_list
service
=
described_class
.
new
(
project
,
user
)
expect
{
service
.
execute
(
list
)
}.
not_to
change
(
board
.
lists
,
:count
)
...
...
spec/services/boards/lists/move_service_spec.rb
View file @
97551e8d
...
...
@@ -6,12 +6,12 @@ describe Boards::Lists::MoveService, services: true do
let
(
:board
)
{
project
.
board
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:backlog
)
{
create
(
:backlog_list
,
board:
board
)
}
let!
(
:backlog
)
{
project
.
board
.
backlog_list
}
let!
(
:planning
)
{
create
(
:list
,
board:
board
,
position:
0
)
}
let!
(
:development
)
{
create
(
:list
,
board:
board
,
position:
1
)
}
let!
(
:review
)
{
create
(
:list
,
board:
board
,
position:
2
)
}
let!
(
:staging
)
{
create
(
:list
,
board:
board
,
position:
3
)
}
let!
(
:done
)
{
create
(
:done_list
,
board:
board
)
}
let!
(
:done
)
{
project
.
board
.
done_list
}
context
'when list type is set to label'
do
it
'keeps position of lists when new position is nil'
do
...
...
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