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
ab032256
Commit
ab032256
authored
May 13, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some tests for merge API
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
5880d7df
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
CHANGELOG
CHANGELOG
+1
-0
lib/api/merge_requests.rb
lib/api/merge_requests.rb
+2
-2
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+11
-4
No files found.
CHANGELOG
View file @
ab032256
...
...
@@ -14,6 +14,7 @@ v 6.9.0
- Fix wiki backup skip bug
- Two Step MR creation process
- Remove unwanted files from satellite working directory with git clean -fdx
- Accept merge request via API (sponsored by O'Reilly Media)
v 6.8.0
- Ability to at mention users that are participating in issue and merge req. discussion
...
...
lib/api/merge_requests.rb
View file @
ab032256
...
...
@@ -34,7 +34,7 @@ module API
when
"closed"
then
user_project
.
merge_requests
.
closed
when
"merged"
then
user_project
.
merge_requests
.
merged
else
user_project
.
merge_requests
end
end
present
paginate
(
mrs
),
with:
Entities
::
MergeRequest
end
...
...
@@ -129,7 +129,7 @@ module API
:push_code
end
if
can?
(
current_user
,
action
,
project
)
if
can?
(
current_user
,
action
,
user_
project
)
if
merge_request
.
unchecked?
merge_request
.
check_if_can_be_merged
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
ab032256
...
...
@@ -183,11 +183,18 @@ describe API::API, api: true do
end
end
describe
"PUT /projects/:id/merge_request/:merge_request_id to merge MR"
do
it
"should return merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
state_event:
"merge"
describe
"PUT /projects/:id/merge_request/:merge_request_id/merge"
do
it
"should return merge_request in case of success"
do
MergeRequest
.
any_instance
.
stub
(
can_be_merged?:
true
,
automerge!:
true
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
/merge"
,
user
)
response
.
status
.
should
==
200
json_response
[
'state'
].
should
==
'merged'
end
it
"should return 405 if branch can't be merged"
do
MergeRequest
.
any_instance
.
stub
(
can_be_merged?:
false
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
/merge"
,
user
)
response
.
status
.
should
==
405
json_response
[
'message'
].
should
==
'Branch cannot be merged'
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