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
c17f5d06
Commit
c17f5d06
authored
Aug 04, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix merge api and spec
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
66bdbdb3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+1
-1
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+12
-14
No files found.
lib/api/merge_requests.rb
View file @
c17f5d06
...
...
@@ -200,7 +200,7 @@ module API
if
merge_request
.
can_be_merged?
commit_message
=
params
[
:merge_commit_message
]
||
merge_request
.
merge_commit_message
MergeRequests
::
MergeService
.
new
(
merge_request
.
target_project
,
current_user
).
::
MergeRequests
::
MergeService
.
new
(
merge_request
.
target_project
,
current_user
).
execute
(
merge_request
,
commit_message
)
present
merge_request
,
with:
Entities
::
MergeRequest
...
...
spec/requests/api/merge_requests_spec.rb
View file @
c17f5d06
...
...
@@ -147,7 +147,7 @@ describe API::API, api: true do
it
"should return merge_request"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
'Test merge_request'
,
source_branch:
'
stable
'
,
source_branch:
'
feature_conflict
'
,
target_branch:
'master'
,
author:
user
,
labels:
'label, label2'
...
...
@@ -170,20 +170,20 @@ describe API::API, api: true do
it
"should return 400 when target_branch is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
"Test merge_request"
,
source_branch:
"
stable
"
,
author:
user
title:
"Test merge_request"
,
source_branch:
"
markdown
"
,
author:
user
expect
(
response
.
status
).
to
eq
(
400
)
end
it
"should return 400 when title is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
target_branch:
'master'
,
source_branch:
'
stable
'
target_branch:
'master'
,
source_branch:
'
markdown
'
expect
(
response
.
status
).
to
eq
(
400
)
end
it
'should return 400 on invalid label names'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
'Test merge_request'
,
source_branch:
'
stable
'
,
source_branch:
'
markdown
'
,
target_branch:
'master'
,
author:
user
,
labels:
'label, ?'
...
...
@@ -197,7 +197,7 @@ describe API::API, api: true do
before
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
'Test merge_request'
,
source_branch:
'
stable
'
,
source_branch:
'
feature_conflict
'
,
target_branch:
'master'
,
author:
user
@mr
=
MergeRequest
.
all
.
last
...
...
@@ -207,7 +207,7 @@ describe API::API, api: true do
expect
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
'New test merge_request'
,
source_branch:
'
stable
'
,
source_branch:
'
feature_conflict
'
,
target_branch:
'master'
,
author:
user
end
.
to
change
{
MergeRequest
.
count
}.
by
(
0
)
...
...
@@ -227,7 +227,8 @@ describe API::API, api: true do
it
"should return merge_request"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
source_branch:
"stable"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
,
description:
'Test description for Test merge_request'
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'
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
json_response
[
'title'
]).
to
eq
(
'Test merge_request'
)
expect
(
json_response
[
'description'
]).
to
eq
(
'Test description for Test merge_request'
)
...
...
@@ -257,7 +258,7 @@ describe API::API, api: true do
it
"should return 400 when title is missing"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
target_branch:
'master'
,
source_branch:
'
stable
'
,
author:
user2
,
target_project_id:
project
.
id
target_branch:
'master'
,
source_branch:
'
markdown
'
,
author:
user2
,
target_project_id:
project
.
id
expect
(
response
.
status
).
to
eq
(
400
)
end
...
...
@@ -266,7 +267,7 @@ describe API::API, api: true do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'
stable
'
,
source_branch:
'
markdown
'
,
author:
user
,
target_project_id:
fork_project
.
id
expect
(
response
.
status
).
to
eq
(
422
)
...
...
@@ -276,7 +277,7 @@ describe API::API, api: true do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'
stable
'
,
source_branch:
'
markdown
'
,
author:
user2
,
target_project_id:
unrelated_project
.
id
expect
(
response
.
status
).
to
eq
(
422
)
...
...
@@ -285,7 +286,7 @@ describe API::API, api: true do
it
"should return 201 when target_branch is specified and for the same project"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'
stable
'
,
author:
user2
,
target_project_id:
fork_project
.
id
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'
markdown
'
,
author:
user2
,
target_project_id:
fork_project
.
id
expect
(
response
.
status
).
to
eq
(
201
)
end
end
...
...
@@ -301,9 +302,6 @@ describe API::API, api: true do
describe
"PUT /projects/:id/merge_request/:merge_request_id/merge"
do
it
"should return merge_request in case of success"
do
allow_any_instance_of
(
MergeRequest
).
to
receive_messages
(
can_be_merged?:
true
,
automerge!:
true
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
/merge"
,
user
)
expect
(
response
.
status
).
to
eq
(
200
)
...
...
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