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
ac7af45d
Commit
ac7af45d
authored
Jan 31, 2015
by
Marco Wessel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for default branch protection configuration
parent
20e269cb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
spec/services/git_push_service_spec.rb
spec/services/git_push_service_spec.rb
+18
-0
No files found.
spec/services/git_push_service_spec.rb
View file @
ac7af45d
...
...
@@ -110,6 +110,24 @@ describe GitPushService do
service
.
execute
(
project
,
user
,
@blankrev
,
'newrev'
,
'refs/heads/master'
)
end
it
"when pushing a branch for the first time with default branch protection disabled"
do
ApplicationSetting
.
any_instance
.
stub
(
default_branch_protection:
0
)
project
.
should_receive
(
:execute_hooks
)
project
.
default_branch
.
should
==
"master"
project
.
protected_branches
.
should_not_receive
(
:create
)
service
.
execute
(
project
,
user
,
@blankrev
,
'newrev'
,
'refs/heads/master'
)
end
it
"when pushing a branch for the first time with default branch protection set to 'developers can push'"
do
ApplicationSetting
.
any_instance
.
stub
(
default_branch_protection:
1
)
project
.
should_receive
(
:execute_hooks
)
project
.
default_branch
.
should
==
"master"
project
.
protected_branches
.
should_receive
(
:create
).
with
({
name:
"master"
,
developers_can_push:
true
})
service
.
execute
(
project
,
user
,
@blankrev
,
'newrev'
,
'refs/heads/master'
)
end
it
"when pushing new commits to existing branch"
do
project
.
should_receive
(
:execute_hooks
)
service
.
execute
(
project
,
user
,
'oldrev'
,
'newrev'
,
'refs/heads/master'
)
...
...
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