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
412db187
Commit
412db187
authored
Aug 09, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some tests and report the error message
parent
a85eed64
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
12 deletions
+29
-12
app/models/repository.rb
app/models/repository.rb
+2
-2
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+1
-1
spec/factories/deployments.rb
spec/factories/deployments.rb
+4
-0
spec/factories/merge_requests.rb
spec/factories/merge_requests.rb
+2
-1
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+16
-4
spec/services/ci/create_pipeline_service_spec.rb
spec/services/ci/create_pipeline_service_spec.rb
+1
-1
spec/services/issues/resolve_discussions_spec.rb
spec/services/issues/resolve_discussions_spec.rb
+1
-1
spec/support/issuables_list_metadata_shared_examples.rb
spec/support/issuables_list_metadata_shared_examples.rb
+2
-2
No files found.
app/models/repository.rb
View file @
412db187
...
@@ -1021,10 +1021,10 @@ class Repository
...
@@ -1021,10 +1021,10 @@ class Repository
def
fetch_ref
(
source_path
,
source_ref
,
target_ref
)
def
fetch_ref
(
source_path
,
source_ref
,
target_ref
)
args
=
%W(fetch --no-tags -f
#{
source_path
}
#{
source_ref
}
:
#{
target_ref
}
)
args
=
%W(fetch --no-tags -f
#{
source_path
}
#{
source_ref
}
:
#{
target_ref
}
)
run_git
(
args
)
message
,
status
=
run_git
(
args
)
# Make sure ref was created, and raise Rugged::ReferenceError when not
# Make sure ref was created, and raise Rugged::ReferenceError when not
raise
Rugged
::
ReferenceError
unless
ref_exists?
(
target_ref
)
raise
Rugged
::
ReferenceError
,
message
unless
ref_exists?
(
target_ref
)
end
end
def
create_ref
(
ref
,
ref_path
)
def
create_ref
(
ref
,
ref_path
)
...
...
spec/controllers/projects/issues_controller_spec.rb
View file @
412db187
require
(
'spec_helper'
)
require
(
'spec_helper'
)
describe
Projects
::
IssuesController
do
describe
Projects
::
IssuesController
do
let
(
:project
)
{
create
(
:project
_empty_repo
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
)
}
...
...
spec/factories/deployments.rb
View file @
412db187
...
@@ -10,6 +10,10 @@ FactoryGirl.define do
...
@@ -10,6 +10,10 @@ FactoryGirl.define do
after
(
:build
)
do
|
deployment
,
evaluator
|
after
(
:build
)
do
|
deployment
,
evaluator
|
deployment
.
project
||=
deployment
.
environment
.
project
deployment
.
project
||=
deployment
.
environment
.
project
unless
deployment
.
project
.
repository_exists?
allow
(
deployment
.
project
.
repository
).
to
receive
(
:fetch_ref
)
end
end
end
end
end
end
end
spec/factories/merge_requests.rb
View file @
412db187
...
@@ -70,10 +70,11 @@ FactoryGirl.define do
...
@@ -70,10 +70,11 @@ FactoryGirl.define do
after
(
:build
)
do
|
merge_request
|
after
(
:build
)
do
|
merge_request
|
target_project
=
merge_request
.
target_project
target_project
=
merge_request
.
target_project
source_project
=
merge_request
.
source_project
# Fake `fetch_ref` if we don't have repository
# Fake `fetch_ref` if we don't have repository
# We have too many existing tests replying on this behaviour
# We have too many existing tests replying on this behaviour
unless
target_project
.
repository_exists?
unless
[
target_project
,
source_project
].
all?
(
&
:repository_exists?
)
allow
(
target_project
.
repository
).
to
receive
(
:fetch_ref
)
allow
(
target_project
.
repository
).
to
receive
(
:fetch_ref
)
end
end
end
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
412db187
...
@@ -580,15 +580,27 @@ describe API::MergeRequests do
...
@@ -580,15 +580,27 @@ describe API::MergeRequests do
let!
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
,
namespace:
user2
.
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:fork_project
)
{
create
(
:project
,
forked_from_project:
project
,
namespace:
user2
.
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:unrelated_project
)
{
create
(
:project
,
namespace:
create
(
:user
).
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:unrelated_project
)
{
create
(
:project
,
namespace:
create
(
:user
).
namespace
,
creator_id:
user2
.
id
)
}
before
:each
do
|
each
|
before
do
fork_project
.
team
<<
[
user2
,
:reporter
]
fork_project
.
add_reporter
(
user2
)
Project
.
all
.
each
(
&
method
(
:stub_project_repository_fetch_ref
))
end
def
stub_project_repository_fetch_ref
(
project
)
allow
(
Project
).
to
receive
(
:find_by
).
with
(
id:
project
.
id
.
to_s
)
.
and_return
(
project
)
allow
(
Project
).
to
receive
(
:find
).
with
(
project
.
id
)
.
and_return
(
project
)
allow
(
project
.
repository
).
to
receive
(
:fetch_ref
)
end
end
it
"returns merge_request"
do
it
"returns merge_request"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
source_branch:
"feature_conflict"
,
target_branch:
"master"
,
title:
'Test merge_request'
,
source_branch:
"feature_conflict"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
,
description:
'Test description for Test merge_request'
author:
user2
,
target_project_id:
project
.
id
,
description:
'Test description for Test merge_request'
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_
gitlab_
http_status
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
'Test merge_request'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'Test merge_request'
)
expect
(
json_response
[
'description'
]).
to
eq
(
'Test description for Test merge_request'
)
expect
(
json_response
[
'description'
]).
to
eq
(
'Test description for Test merge_request'
)
end
end
...
@@ -599,7 +611,7 @@ describe API::MergeRequests do
...
@@ -599,7 +611,7 @@ describe API::MergeRequests do
expect
(
fork_project
.
forked_from_project
).
to
eq
(
project
)
expect
(
fork_project
.
forked_from_project
).
to
eq
(
project
)
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
source_branch:
"master"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
title:
'Test merge_request'
,
source_branch:
"master"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_
gitlab_
http_status
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
'Test merge_request'
)
expect
(
json_response
[
'title'
]).
to
eq
(
'Test merge_request'
)
end
end
...
...
spec/services/ci/create_pipeline_service_spec.rb
View file @
412db187
...
@@ -66,7 +66,7 @@ describe Ci::CreatePipelineService do
...
@@ -66,7 +66,7 @@ describe Ci::CreatePipelineService do
context
'when there is no pipeline for source branch'
do
context
'when there is no pipeline for source branch'
do
it
"does not update merge request head pipeline"
do
it
"does not update merge request head pipeline"
do
merge_request
=
create
(
:merge_request
,
source_branch:
'
other_branch
'
,
target_branch:
"branch_1"
,
source_project:
project
)
merge_request
=
create
(
:merge_request
,
source_branch:
'
feature
'
,
target_branch:
"branch_1"
,
source_project:
project
)
head_pipeline
=
pipeline
head_pipeline
=
pipeline
...
...
spec/services/issues/resolve_discussions_spec.rb
View file @
412db187
...
@@ -20,7 +20,7 @@ describe Issues::ResolveDiscussions do
...
@@ -20,7 +20,7 @@ describe Issues::ResolveDiscussions do
describe
"for resolving discussions"
do
describe
"for resolving discussions"
do
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
note:
"Almost done"
).
to_discussion
}
let
(
:discussion
)
{
create
(
:diff_note_on_merge_request
,
project:
project
,
note:
"Almost done"
).
to_discussion
}
let
(
:merge_request
)
{
discussion
.
noteable
}
let
(
:merge_request
)
{
discussion
.
noteable
}
let
(
:other_merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
"
other
"
)
}
let
(
:other_merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
"
fix
"
)
}
describe
"#merge_request_for_resolving_discussion"
do
describe
"#merge_request_for_resolving_discussion"
do
let
(
:service
)
{
DummyService
.
new
(
project
,
user
,
merge_request_to_resolve_discussions_of:
merge_request
.
iid
)
}
let
(
:service
)
{
DummyService
.
new
(
project
,
user
,
merge_request_to_resolve_discussions_of:
merge_request
.
iid
)
}
...
...
spec/support/issuables_list_metadata_shared_examples.rb
View file @
412db187
...
@@ -2,12 +2,12 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
...
@@ -2,12 +2,12 @@ shared_examples 'issuables list meta-data' do |issuable_type, action = nil|
before
do
before
do
@issuable_ids
=
[]
@issuable_ids
=
[]
2
.
times
do
|
n
|
%w[fix improve/awesome]
.
each
do
|
source_branch
|
issuable
=
issuable
=
if
issuable_type
==
:issue
if
issuable_type
==
:issue
create
(
issuable_type
,
project:
project
)
create
(
issuable_type
,
project:
project
)
else
else
create
(
issuable_type
,
source_project:
project
,
source_branch:
"
#{
n
}
-feature"
)
create
(
issuable_type
,
source_project:
project
,
source_branch:
source_branch
)
end
end
@issuable_ids
<<
issuable
.
id
@issuable_ids
<<
issuable
.
id
...
...
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