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
Boxiang Sun
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
Show 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
...
@@ -14,6 +14,7 @@ v 6.9.0
- Fix wiki backup skip bug
- Fix wiki backup skip bug
- Two Step MR creation process
- Two Step MR creation process
- Remove unwanted files from satellite working directory with git clean -fdx
- 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
v 6.8.0
- Ability to at mention users that are participating in issue and merge req. discussion
- Ability to at mention users that are participating in issue and merge req. discussion
...
...
lib/api/merge_requests.rb
View file @
ab032256
...
@@ -129,7 +129,7 @@ module API
...
@@ -129,7 +129,7 @@ module API
:push_code
:push_code
end
end
if
can?
(
current_user
,
action
,
project
)
if
can?
(
current_user
,
action
,
user_
project
)
if
merge_request
.
unchecked?
if
merge_request
.
unchecked?
merge_request
.
check_if_can_be_merged
merge_request
.
check_if_can_be_merged
end
end
...
...
spec/requests/api/merge_requests_spec.rb
View file @
ab032256
...
@@ -183,11 +183,18 @@ describe API::API, api: true do
...
@@ -183,11 +183,18 @@ describe API::API, api: true do
end
end
end
end
describe
"PUT /projects/:id/merge_request/:merge_request_id to merge MR"
do
describe
"PUT /projects/:id/merge_request/:merge_request_id/merge"
do
it
"should return merge_request"
do
it
"should return merge_request in case of success"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
state_event:
"merge"
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
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
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