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
d339ad2f
Commit
d339ad2f
authored
Aug 31, 2017
by
Tiago Botelho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes bug where mirror trigger builds is nil at project create.
parent
11eaff63
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
9 deletions
+46
-9
ee/app/services/ee/projects/create_service.rb
ee/app/services/ee/projects/create_service.rb
+2
-2
spec/ee/spec/services/ee/projects/create_service_spec.rb
spec/ee/spec/services/ee/projects/create_service_spec.rb
+44
-7
No files found.
ee/app/services/ee/projects/create_service.rb
View file @
d339ad2f
...
...
@@ -10,9 +10,9 @@ module EE
super
do
|
project
|
if
mirror
&&
project
.
feature_available?
(
:repository_mirrors
)
project
.
mirror
=
mirror
project
.
mirror
=
mirror
unless
mirror
.
nil?
project
.
mirror_trigger_builds
=
mirror_trigger_builds
unless
mirror_trigger_builds
.
nil?
project
.
mirror_user_id
=
mirror_user_id
project
.
mirror_trigger_builds
=
mirror_trigger_builds
end
end
end
...
...
spec/ee/spec/services/ee/projects/create_service_spec.rb
View file @
d339ad2f
...
...
@@ -33,12 +33,25 @@ describe Projects::CreateService, '#execute' do
end
end
context
'repository mirror'
do
context
'without repository mirror'
do
before
do
stub_licensed_features
(
repository_mirrors:
true
)
opts
.
merge!
(
import_url:
'http://foo.com'
)
end
it
'sets the mirror to false'
do
project
=
create_project
(
user
,
opts
)
expect
(
project
).
to
be_persisted
expect
(
project
.
mirror
).
to
be
false
end
end
context
'with repository mirror'
do
before
do
opts
.
merge!
(
import_url:
'http://foo.com'
,
mirror:
true
,
mirror_user_id:
user
.
id
,
mirror_trigger_builds:
true
)
mirror_user_id:
user
.
id
)
end
context
'when licensed'
do
...
...
@@ -49,10 +62,22 @@ describe Projects::CreateService, '#execute' do
it
'sets the correct attributes'
do
project
=
create_project
(
user
,
opts
)
expect
(
project
).
to
be_
vali
d
expect
(
project
).
to
be_
persiste
d
expect
(
project
.
mirror
).
to
be
true
expect
(
project
.
mirror_user_id
).
to
eq
(
user
.
id
)
expect
(
project
.
mirror_trigger_builds
).
to
be
true
end
context
'with mirror trigger builds'
do
before
do
opts
.
merge!
(
mirror_trigger_builds:
true
)
end
it
'sets the mirror trigger builds'
do
project
=
create_project
(
user
,
opts
)
expect
(
project
).
to
be_persisted
expect
(
project
.
mirror_trigger_builds
).
to
be
true
end
end
end
...
...
@@ -64,10 +89,22 @@ describe Projects::CreateService, '#execute' do
it
'does not set mirror attributes'
do
project
=
create_project
(
user
,
opts
)
expect
(
project
).
to
be_
vali
d
expect
(
project
).
to
be_
persiste
d
expect
(
project
.
mirror
).
to
be
false
expect
(
project
.
mirror_user_id
).
to
be_nil
expect
(
project
.
mirror_trigger_builds
).
to
be
false
end
context
'with mirror trigger builds'
do
before
do
opts
.
merge!
(
mirror_trigger_builds:
true
)
end
it
'sets the mirror trigger builds'
do
project
=
create_project
(
user
,
opts
)
expect
(
project
).
to
be_persisted
expect
(
project
.
mirror_trigger_builds
).
to
be
false
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