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
72f53873
Commit
72f53873
authored
Nov 16, 2016
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove redundant call to after branch delete service
parent
d9d69d7b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
22 deletions
+16
-22
app/services/delete_branch_service.rb
app/services/delete_branch_service.rb
+0
-9
spec/features/environments_spec.rb
spec/features/environments_spec.rb
+16
-1
spec/services/delete_branch_service_spec.rb
spec/services/delete_branch_service_spec.rb
+0
-12
No files found.
app/services/delete_branch_service.rb
View file @
72f53873
...
...
@@ -22,7 +22,6 @@ class DeleteBranchService < BaseService
end
if
repository
.
rm_branch
(
current_user
,
branch_name
)
execute_after_branch_delete_hooks
(
branch_name
)
success
(
'Branch was removed'
)
else
error
(
'Failed to remove branch'
)
...
...
@@ -48,12 +47,4 @@ class DeleteBranchService < BaseService
"
#{
Gitlab
::
Git
::
BRANCH_REF_PREFIX
}#{
branch
.
name
}
"
,
[])
end
private
def
execute_after_branch_delete_hooks
(
branch_name
)
AfterBranchDeleteService
.
new
(
project
,
current_user
)
.
execute
(
branch_name
)
end
end
spec/features/environments_spec.rb
View file @
72f53873
...
...
@@ -291,11 +291,26 @@ feature 'Environments', feature: true do
scenario
'user deletes the branch with running environment'
do
visit
namespace_project_branches_path
(
project
.
namespace
,
project
)
remove_branch_with_hooks
(
project
,
user
,
'feature'
)
do
page
.
within
(
'.js-branch-feature'
)
{
find
(
'a.btn-remove'
).
click
}
end
visit_environment
(
environment
)
expect
(
page
).
to
have_no_link
(
'Stop'
)
end
def
remove_branch_with_hooks
(
project
,
user
,
branch
)
params
=
{
oldrev:
project
.
commit
(
branch
).
id
,
newrev:
Gitlab
::
Git
::
BLANK_SHA
,
ref:
"refs/heads/
#{
branch
}
"
}
yield
GitPushService
.
new
(
project
,
user
,
params
).
execute
end
end
def
visit_environments
(
project
)
...
...
spec/services/delete_branch_service_spec.rb
View file @
72f53873
...
...
@@ -20,12 +20,6 @@ describe DeleteBranchService, services: true do
expect
(
result
[
:status
]).
to
eq
:success
expect
(
branch_exists?
(
'feature'
)).
to
be
false
end
it
'calls after branch delete hooks'
do
expect
(
service
).
to
receive
(
:execute_after_branch_delete_hooks
)
service
.
execute
(
'feature'
)
end
end
context
'when user does not have access to push to repository'
do
...
...
@@ -38,12 +32,6 @@ describe DeleteBranchService, services: true do
expect
(
result
[
:message
]).
to
eq
'You dont have push access to repo'
expect
(
branch_exists?
(
'feature'
)).
to
be
true
end
it
'does not call after branch delete hooks'
do
expect
(
service
).
not_to
receive
(
:execute_after_branch_delete_hooks
)
service
.
execute
(
'feature'
)
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