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
d1458d92
Commit
d1458d92
authored
Oct 18, 2016
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Does not remove board from project when project have only one board
parent
ff04bc3f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
6 deletions
+19
-6
app/services/boards/destroy_service.rb
app/services/boards/destroy_service.rb
+2
-0
spec/controllers/projects/boards_controller_spec.rb
spec/controllers/projects/boards_controller_spec.rb
+2
-1
spec/services/boards/destroy_service_spec.rb
spec/services/boards/destroy_service_spec.rb
+15
-5
No files found.
app/services/boards/destroy_service.rb
View file @
d1458d92
module
Boards
module
Boards
class
DestroyService
<
Boards
::
BaseService
class
DestroyService
<
Boards
::
BaseService
def
execute
(
board
)
def
execute
(
board
)
return
false
if
project
.
boards
.
size
==
1
board
.
destroy
board
.
destroy
end
end
end
end
...
...
spec/controllers/projects/boards_controller_spec.rb
View file @
d1458d92
...
@@ -239,7 +239,8 @@ describe Projects::BoardsController do
...
@@ -239,7 +239,8 @@ describe Projects::BoardsController do
end
end
describe
'DELETE destroy'
do
describe
'DELETE destroy'
do
let!
(
:board
)
{
create
(
:board
,
project:
project
)
}
let!
(
:boards
)
{
create_pair
(
:board
,
project:
project
)
}
let
(
:board
)
{
project
.
boards
.
first
}
context
'with valid board id'
do
context
'with valid board id'
do
it
'redirects to the issue boards page'
do
it
'redirects to the issue boards page'
do
...
...
spec/services/boards/destroy_service_spec.rb
View file @
d1458d92
...
@@ -2,13 +2,23 @@ require 'spec_helper'
...
@@ -2,13 +2,23 @@ require 'spec_helper'
describe
Boards
::
DestroyService
,
services:
true
do
describe
Boards
::
DestroyService
,
services:
true
do
describe
'#execute'
do
describe
'#execute'
do
it
'removes board from project'
do
let
(
:project
)
{
create
(
:empty_project
)
}
project
=
create
(
:empty_project
)
let!
(
:board
)
{
create
(
:board
,
project:
project
)
}
board
=
create
(
:board
,
project:
project
)
service
=
described_class
.
new
(
project
,
double
)
subject
(
:service
)
{
described_class
.
new
(
project
,
double
)
}
expect
{
service
.
execute
(
board
)
}.
to
change
(
project
.
boards
,
:count
).
by
(
-
1
)
context
'when project have more than one board'
do
it
'removes board from project'
do
create
(
:board
,
project:
project
)
expect
{
service
.
execute
(
board
)
}.
to
change
(
project
.
boards
,
:count
).
by
(
-
1
)
end
end
context
'when project have one board'
do
it
'does not remove board from project'
do
expect
{
service
.
execute
(
board
)
}.
not_to
change
(
project
.
boards
,
:count
)
end
end
end
end
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