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
ae7c52a0
Commit
ae7c52a0
authored
Aug 11, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix more tests
parent
41a5adca
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
120 additions
and
119 deletions
+120
-119
spec/controllers/projects/issues_controller_spec.rb
spec/controllers/projects/issues_controller_spec.rb
+2
-0
spec/features/merge_requests/filter_merge_requests_spec.rb
spec/features/merge_requests/filter_merge_requests_spec.rb
+6
-6
spec/features/merge_requests/reset_filters_spec.rb
spec/features/merge_requests/reset_filters_spec.rb
+3
-3
spec/features/task_lists_spec.rb
spec/features/task_lists_spec.rb
+4
-0
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+97
-106
spec/services/create_deployment_service_spec.rb
spec/services/create_deployment_service_spec.rb
+4
-0
spec/services/merge_requests/get_urls_service_spec.rb
spec/services/merge_requests/get_urls_service_spec.rb
+4
-4
No files found.
spec/controllers/projects/issues_controller_spec.rb
View file @
ae7c52a0
...
...
@@ -858,6 +858,8 @@ describe Projects::IssuesController do
before
do
project
.
add_developer
(
user
)
sign_in
(
user
)
allow_any_instance_of
(
MergeRequest
).
to
receive
(
:write_ref
)
end
it
'creates a new merge request'
do
...
...
spec/features/merge_requests/filter_merge_requests_spec.rb
View file @
ae7c52a0
...
...
@@ -12,7 +12,7 @@ describe 'Filter merge requests' do
let!
(
:wontfix
)
{
create
(
:label
,
project:
project
,
title:
"Won't fix"
)
}
before
do
project
.
team
<<
[
user
,
:master
]
project
.
add_master
(
user
)
group
.
add_developer
(
user
)
sign_in
(
user
)
create
(
:merge_request
,
source_project:
project
,
target_project:
project
)
...
...
@@ -170,7 +170,7 @@ describe 'Filter merge requests' do
describe
'filter merge requests by text'
do
before
do
create
(
:merge_request
,
title:
"Bug"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
bug
"
)
create
(
:merge_request
,
title:
"Bug"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
wip
"
)
bug_label
=
create
(
:label
,
project:
project
,
title:
'bug'
)
milestone
=
create
(
:milestone
,
title:
"8"
,
project:
project
)
...
...
@@ -179,7 +179,7 @@ describe 'Filter merge requests' do
title:
"Bug 2"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
bug2
"
,
source_branch:
"
fix
"
,
milestone:
milestone
,
author:
user
,
assignee:
user
)
...
...
@@ -259,12 +259,12 @@ describe 'Filter merge requests' do
end
end
describe
'filter merge requests and sort'
,
js:
true
do
describe
'filter merge requests and sort'
,
:js
do
before
do
bug_label
=
create
(
:label
,
project:
project
,
title:
'bug'
)
mr1
=
create
(
:merge_request
,
title:
"Frontend"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
Frontend
"
)
mr2
=
create
(
:merge_request
,
title:
"Bug 2"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
bug2
"
)
mr1
=
create
(
:merge_request
,
title:
"Frontend"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
wip
"
)
mr2
=
create
(
:merge_request
,
title:
"Bug 2"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
fix
"
)
mr1
.
labels
<<
bug_label
mr2
.
labels
<<
bug_label
...
...
spec/features/merge_requests/reset_filters_spec.rb
View file @
ae7c52a0
require
'rails_helper'
feature
'Merge requests filter clear button'
,
js:
true
do
feature
'Merge requests filter clear button'
,
:js
do
include
FilteredSearchHelpers
include
MergeRequestHelpers
include
IssueHelpers
...
...
@@ -9,8 +9,8 @@ feature 'Merge requests filter clear button', js: true do
let!
(
:user
)
{
create
(
:user
)
}
let!
(
:milestone
)
{
create
(
:milestone
,
project:
project
)
}
let!
(
:bug
)
{
create
(
:label
,
project:
project
,
name:
'bug'
)}
let!
(
:mr1
)
{
create
(
:merge_request
,
title:
"Feature"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
Featur
e"
,
milestone:
milestone
,
author:
user
,
assignee:
user
)
}
let!
(
:mr2
)
{
create
(
:merge_request
,
title:
"Bugfix1"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
Bugfix1
"
)
}
let!
(
:mr1
)
{
create
(
:merge_request
,
title:
"Feature"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
improve/awesom
e"
,
milestone:
milestone
,
author:
user
,
assignee:
user
)
}
let!
(
:mr2
)
{
create
(
:merge_request
,
title:
"Bugfix1"
,
source_project:
project
,
target_project:
project
,
source_branch:
"
fix
"
)
}
let
(
:merge_request_css
)
{
'.merge-request'
}
let
(
:clear_search_css
)
{
'.filtered-search-box .clear-search'
}
...
...
spec/features/task_lists_spec.rb
View file @
ae7c52a0
...
...
@@ -245,6 +245,10 @@ feature 'Task Lists' do
visit
project_merge_request_path
(
project
,
merge
)
end
before
do
allow_any_instance_of
(
Repository
).
to
receive
(
:write_ref
)
end
describe
'multiple tasks'
do
let!
(
:merge
)
{
create
(
:merge_request
,
:simple
,
description:
markdown
,
author:
user
,
source_project:
project
)
}
...
...
spec/requests/api/merge_requests_spec.rb
View file @
ae7c52a0
...
...
@@ -31,7 +31,7 @@ describe API::MergeRequests do
it
'returns authentication error'
do
get
api
(
'/merge_requests'
)
expect
(
response
).
to
have_http_status
(
401
)
expect
(
response
).
to
have_
gitlab_
http_status
(
401
)
end
end
...
...
@@ -43,7 +43,7 @@ describe API::MergeRequests do
it
'returns an array of all merge requests'
do
get
api
(
'/merge_requests'
,
user
),
scope: :all
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
map
{
|
mr
|
mr
[
'id'
]
})
...
...
@@ -56,7 +56,7 @@ describe API::MergeRequests do
get
api
(
'/merge_requests'
,
user
),
scope: :all
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
map
{
|
mr
|
mr
[
'id'
]
})
...
...
@@ -68,7 +68,7 @@ describe API::MergeRequests do
get
api
(
'/merge_requests'
,
user2
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
merge_request3
.
id
)
...
...
@@ -79,7 +79,7 @@ describe API::MergeRequests do
get
api
(
'/merge_requests'
,
user
),
author_id:
user2
.
id
,
scope: :all
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
merge_request3
.
id
)
...
...
@@ -90,7 +90,7 @@ describe API::MergeRequests do
get
api
(
'/merge_requests'
,
user
),
assignee_id:
user2
.
id
,
scope: :all
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
merge_request3
.
id
)
...
...
@@ -101,7 +101,7 @@ describe API::MergeRequests do
get
api
(
'/merge_requests'
,
user2
),
scope:
'assigned-to-me'
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
merge_request3
.
id
)
...
...
@@ -112,7 +112,7 @@ describe API::MergeRequests do
get
api
(
'/merge_requests'
,
user2
),
scope:
'created-by-me'
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
merge_request3
.
id
)
...
...
@@ -125,7 +125,7 @@ describe API::MergeRequests do
it
"returns authentication error"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
)
expect
(
response
).
to
have_http_status
(
401
)
expect
(
response
).
to
have_
gitlab_
http_status
(
401
)
end
end
...
...
@@ -145,7 +145,7 @@ describe API::MergeRequests do
it
"returns an array of all merge_requests"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
...
...
@@ -166,7 +166,7 @@ describe API::MergeRequests do
it
"returns an array of all merge_requests using simple mode"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?view=simple"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
.
last
.
keys
).
to
match_array
(
%w(id iid title web_url created_at description project_id state updated_at)
)
expect
(
json_response
).
to
be_an
Array
...
...
@@ -182,7 +182,7 @@ describe API::MergeRequests do
it
"returns an array of all merge_requests"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?state"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
...
...
@@ -192,7 +192,7 @@ describe API::MergeRequests do
it
"returns an array of open merge_requests"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?state=opened"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
...
...
@@ -202,7 +202,7 @@ describe API::MergeRequests do
it
"returns an array of closed merge_requests"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?state=closed"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
...
...
@@ -212,7 +212,7 @@ describe API::MergeRequests do
it
"returns an array of merged merge_requests"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?state=merged"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
...
...
@@ -222,7 +222,7 @@ describe API::MergeRequests do
it
'returns merge_request by "iids" array'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
iids:
[
merge_request
.
iid
,
merge_request_closed
.
iid
]
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
expect
(
json_response
.
first
[
'title'
]).
to
eq
merge_request_closed
.
title
...
...
@@ -232,14 +232,14 @@ describe API::MergeRequests do
it
'matches V4 response schema'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
match_response_schema
(
'public_api/v4/merge_requests'
)
end
it
'returns an empty array if no issue matches milestone'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
milestone:
'1.0.0'
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -247,7 +247,7 @@ describe API::MergeRequests do
it
'returns an empty array if milestone does not exist'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
milestone:
'foo'
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -262,7 +262,7 @@ describe API::MergeRequests do
it
'returns an array of merge requests matching state in milestone'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
milestone:
'0.9'
,
state:
'closed'
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
merge_request_closed
.
id
)
...
...
@@ -271,7 +271,7 @@ describe API::MergeRequests do
it
'returns an array of labeled merge requests'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?labels=
#{
label
.
title
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'labels'
]).
to
eq
([
label2
.
title
,
label
.
title
])
...
...
@@ -280,7 +280,7 @@ describe API::MergeRequests do
it
'returns an array of labeled merge requests where all labels match'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?labels=
#{
label
.
title
}
,foo,bar"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -288,7 +288,7 @@ describe API::MergeRequests do
it
'returns an empty array if no merge request matches labels'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?labels=foo,bar"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
end
...
...
@@ -307,7 +307,7 @@ describe API::MergeRequests do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?labels=
#{
bug_label
.
title
}
&milestone=
#{
milestone1
.
title
}
&state=merged"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'id'
]).
to
eq
(
mr2
.
id
)
...
...
@@ -322,7 +322,7 @@ describe API::MergeRequests do
it
"returns an array of merge_requests in ascending order"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?sort=asc"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
...
...
@@ -333,7 +333,7 @@ describe API::MergeRequests do
it
"returns an array of merge_requests in descending order"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?sort=desc"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
...
...
@@ -344,7 +344,7 @@ describe API::MergeRequests do
it
"returns an array of merge_requests ordered by updated_at"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?order_by=updated_at"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
...
...
@@ -355,7 +355,7 @@ describe API::MergeRequests do
it
"returns an array of merge_requests ordered by created_at"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests?order_by=created_at&sort=asc"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
3
)
...
...
@@ -370,7 +370,7 @@ describe API::MergeRequests do
it
'exposes known attributes'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'id'
]).
to
eq
(
merge_request
.
id
)
expect
(
json_response
[
'iid'
]).
to
eq
(
merge_request
.
iid
)
expect
(
json_response
[
'project_id'
]).
to
eq
(
merge_request
.
project
.
id
)
...
...
@@ -398,7 +398,7 @@ describe API::MergeRequests do
it
"returns merge_request"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
merge_request
.
title
)
expect
(
json_response
[
'iid'
]).
to
eq
(
merge_request
.
iid
)
expect
(
json_response
[
'work_in_progress'
]).
to
eq
(
false
)
...
...
@@ -409,13 +409,13 @@ describe API::MergeRequests do
it
"returns a 404 error if merge_request_iid not found"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/999"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
"returns a 404 error if merge_request `id` is used instead of iid"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
context
'Work in Progress'
do
...
...
@@ -423,7 +423,7 @@ describe API::MergeRequests do
it
"returns merge_request"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request_wip
.
iid
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'work_in_progress'
]).
to
eq
(
true
)
end
end
...
...
@@ -434,7 +434,7 @@ describe API::MergeRequests do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/commits"
,
user
)
commit
=
merge_request
.
commits
.
first
expect
(
response
.
status
).
to
eq
200
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
size
).
to
eq
(
merge_request
.
commits
.
size
)
...
...
@@ -444,13 +444,13 @@ describe API::MergeRequests do
it
'returns a 404 when merge_request_iid not found'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/999/commits"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
'returns a 404 when merge_request id is used instead of iid'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/commits"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
end
...
...
@@ -458,19 +458,19 @@ describe API::MergeRequests do
it
'returns the change information of the merge_request'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/changes"
,
user
)
expect
(
response
.
status
).
to
eq
200
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
json_response
[
'changes'
].
size
).
to
eq
(
merge_request
.
diffs
.
size
)
end
it
'returns a 404 when merge_request_iid not found'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/999/changes"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
'returns a 404 when merge_request id is used instead of iid'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/changes"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
end
...
...
@@ -485,7 +485,7 @@ describe API::MergeRequests do
labels:
'label, label2'
,
milestone_id:
milestone
.
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
[
'labels'
]).
to
eq
(
%w(label label2)
)
expect
(
json_response
[
'milestone'
][
'id'
]).
to
eq
(
milestone
.
id
)
...
...
@@ -495,25 +495,25 @@ describe API::MergeRequests do
it
"returns 422 when source_branch equals target_branch"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
"Test merge_request"
,
source_branch:
"master"
,
target_branch:
"master"
,
author:
user
expect
(
response
).
to
have_http_status
(
422
)
expect
(
response
).
to
have_
gitlab_
http_status
(
422
)
end
it
"returns 400 when source_branch is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
"Test merge_request"
,
target_branch:
"master"
,
author:
user
expect
(
response
).
to
have_http_status
(
400
)
expect
(
response
).
to
have_
gitlab_
http_status
(
400
)
end
it
"returns 400 when target_branch is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
"Test merge_request"
,
source_branch:
"markdown"
,
author:
user
expect
(
response
).
to
have_http_status
(
400
)
expect
(
response
).
to
have_
gitlab_
http_status
(
400
)
end
it
"returns 400 when title is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
target_branch:
'master'
,
source_branch:
'markdown'
expect
(
response
).
to
have_http_status
(
400
)
expect
(
response
).
to
have_
gitlab_
http_status
(
400
)
end
it
'allows special label names'
do
...
...
@@ -523,7 +523,7 @@ describe API::MergeRequests do
target_branch:
'master'
,
author:
user
,
labels:
'label, label?, label&foo, ?, &'
expect
(
response
.
status
).
to
eq
(
201
)
expect
(
response
).
to
have_gitlab_http_status
(
201
)
expect
(
json_response
[
'labels'
]).
to
include
'label'
expect
(
json_response
[
'labels'
]).
to
include
'label?'
expect
(
json_response
[
'labels'
]).
to
include
'label&foo'
...
...
@@ -549,7 +549,7 @@ describe API::MergeRequests do
target_branch:
'master'
,
author:
user
end
.
to
change
{
MergeRequest
.
count
}.
by
(
0
)
expect
(
response
).
to
have_http_status
(
409
)
expect
(
response
).
to
have_
gitlab_
http_status
(
409
)
end
end
...
...
@@ -583,17 +583,8 @@ describe API::MergeRequests do
before
do
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
)
allow_any_instance_of
(
Repository
).
to
receive
(
:fetch_ref
)
allow_any_instance_of
(
Repository
).
to
receive
(
:write_ref
)
end
it
"returns merge_request"
do
...
...
@@ -625,25 +616,25 @@ describe API::MergeRequests do
author:
user2
,
target_project_id:
project
.
id
expect
(
response
).
to
have_http_status
(
422
)
expect
(
response
).
to
have_
gitlab_
http_status
(
422
)
end
it
"returns 400 when source_branch is missing"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
expect
(
response
).
to
have_http_status
(
400
)
expect
(
response
).
to
have_
gitlab_
http_status
(
400
)
end
it
"returns 400 when target_branch is missing"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
expect
(
response
).
to
have_http_status
(
400
)
expect
(
response
).
to
have_
gitlab_
http_status
(
400
)
end
it
"returns 400 when title is missing"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
target_branch:
'master'
,
source_branch:
'markdown'
,
author:
user2
,
target_project_id:
project
.
id
expect
(
response
).
to
have_http_status
(
400
)
expect
(
response
).
to
have_
gitlab_
http_status
(
400
)
end
context
'when target_branch is specified'
do
...
...
@@ -654,7 +645,7 @@ describe API::MergeRequests do
source_branch:
'markdown'
,
author:
user
,
target_project_id:
fork_project
.
id
expect
(
response
).
to
have_http_status
(
422
)
expect
(
response
).
to
have_
gitlab_
http_status
(
422
)
end
it
'returns 422 if targeting a different fork'
do
...
...
@@ -664,14 +655,14 @@ describe API::MergeRequests do
source_branch:
'markdown'
,
author:
user2
,
target_project_id:
unrelated_project
.
id
expect
(
response
).
to
have_http_status
(
422
)
expect
(
response
).
to
have_
gitlab_
http_status
(
422
)
end
end
it
"returns 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:
'markdown'
,
author:
user2
,
target_project_id:
fork_project
.
id
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_
gitlab_
http_status
(
201
)
end
end
end
...
...
@@ -686,7 +677,7 @@ describe API::MergeRequests do
it
"denies the deletion of the merge request"
do
delete
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
developer
)
expect
(
response
).
to
have_http_status
(
403
)
expect
(
response
).
to
have_
gitlab_
http_status
(
403
)
end
end
...
...
@@ -694,19 +685,19 @@ describe API::MergeRequests do
it
"destroys the merge request owners can destroy"
do
delete
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
204
)
expect
(
response
).
to
have_
gitlab_
http_status
(
204
)
end
it
"returns 404 for an invalid merge request IID"
do
delete
api
(
"/projects/
#{
project
.
id
}
/merge_requests/12345"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
"returns 404 if the merge request id is used instead of iid"
do
delete
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
end
end
...
...
@@ -717,7 +708,7 @@ describe API::MergeRequests do
it
"returns merge_request in case of success"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
end
it
"returns 406 if branch can't be merged"
do
...
...
@@ -726,21 +717,21 @@ describe API::MergeRequests do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_http_status
(
406
)
expect
(
response
).
to
have_
gitlab_
http_status
(
406
)
expect
(
json_response
[
'message'
]).
to
eq
(
'Branch cannot be merged'
)
end
it
"returns 405 if merge_request is not open"
do
merge_request
.
close
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_http_status
(
405
)
expect
(
response
).
to
have_
gitlab_
http_status
(
405
)
expect
(
json_response
[
'message'
]).
to
eq
(
'405 Method Not Allowed'
)
end
it
"returns 405 if merge_request is a work in progress"
do
merge_request
.
update_attribute
(
:title
,
"WIP:
#{
merge_request
.
title
}
"
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_http_status
(
405
)
expect
(
response
).
to
have_
gitlab_
http_status
(
405
)
expect
(
json_response
[
'message'
]).
to
eq
(
'405 Method Not Allowed'
)
end
...
...
@@ -749,7 +740,7 @@ describe API::MergeRequests do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_http_status
(
405
)
expect
(
response
).
to
have_
gitlab_
http_status
(
405
)
expect
(
json_response
[
'message'
]).
to
eq
(
'405 Method Not Allowed'
)
end
...
...
@@ -757,21 +748,21 @@ describe API::MergeRequests do
user2
=
create
(
:user
)
project
.
team
<<
[
user2
,
:reporter
]
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user2
)
expect
(
response
).
to
have_http_status
(
401
)
expect
(
response
).
to
have_
gitlab_
http_status
(
401
)
expect
(
json_response
[
'message'
]).
to
eq
(
'401 Unauthorized'
)
end
it
"returns 409 if the SHA parameter doesn't match"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
),
sha:
merge_request
.
diff_head_sha
.
reverse
expect
(
response
).
to
have_http_status
(
409
)
expect
(
response
).
to
have_
gitlab_
http_status
(
409
)
expect
(
json_response
[
'message'
]).
to
start_with
(
'SHA does not match HEAD of source branch'
)
end
it
"succeeds if the SHA parameter matches"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
),
sha:
merge_request
.
diff_head_sha
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
end
it
"enables merge when pipeline succeeds if the pipeline is active"
do
...
...
@@ -780,7 +771,7 @@ describe API::MergeRequests do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
),
merge_when_pipeline_succeeds:
true
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
'Test'
)
expect
(
json_response
[
'merge_when_pipeline_succeeds'
]).
to
eq
(
true
)
end
...
...
@@ -792,7 +783,7 @@ describe API::MergeRequests do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
),
merge_when_pipeline_succeeds:
true
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
'Test'
)
expect
(
json_response
[
'merge_when_pipeline_succeeds'
]).
to
eq
(
true
)
end
...
...
@@ -800,13 +791,13 @@ describe API::MergeRequests do
it
"returns 404 for an invalid merge request IID"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/12345/merge"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
"returns 404 if the merge request id is used instead of iid"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/merge"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
end
...
...
@@ -815,39 +806,39 @@ describe API::MergeRequests do
it
"returns merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
),
state_event:
"close"
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'state'
]).
to
eq
(
'closed'
)
end
end
it
"updates title and returns merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
),
title:
"New title"
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'title'
]).
to
eq
(
'New title'
)
end
it
"updates description and returns merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
),
description:
"New description"
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'description'
]).
to
eq
(
'New description'
)
end
it
"updates milestone_id and returns merge_request"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
),
milestone_id:
milestone
.
id
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'milestone'
][
'id'
]).
to
eq
(
milestone
.
id
)
end
it
"returns merge_request with renamed target_branch"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
),
target_branch:
"wiki"
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'target_branch'
]).
to
eq
(
'wiki'
)
end
it
"returns merge_request that removes the source branch"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
),
remove_source_branch:
true
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
json_response
[
'force_remove_source_branch'
]).
to
be_truthy
end
...
...
@@ -868,7 +859,7 @@ describe API::MergeRequests do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
),
state_event:
'close'
,
title:
nil
merge_request
.
reload
expect
(
response
).
to
have_http_status
(
400
)
expect
(
response
).
to
have_
gitlab_
http_status
(
400
)
expect
(
merge_request
.
state
).
to
eq
(
'opened'
)
end
...
...
@@ -876,20 +867,20 @@ describe API::MergeRequests do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
"
,
user
),
state_event:
'close'
,
target_branch:
nil
merge_request
.
reload
expect
(
response
).
to
have_http_status
(
400
)
expect
(
response
).
to
have_
gitlab_
http_status
(
400
)
expect
(
merge_request
.
state
).
to
eq
(
'opened'
)
end
it
"returns 404 for an invalid merge request IID"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/12345"
,
user
),
state_event:
"close"
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
"returns 404 if the merge request id is used instead of iid"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
"
,
user
),
state_event:
"close"
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
end
...
...
@@ -902,7 +893,7 @@ describe API::MergeRequests do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
mr
.
iid
}
/closes_issues"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
...
...
@@ -912,7 +903,7 @@ describe API::MergeRequests do
it
'returns an empty array when there are no issues to be closed'
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/closes_issues"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
0
)
...
...
@@ -928,7 +919,7 @@ describe API::MergeRequests do
get
api
(
"/projects/
#{
jira_project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/closes_issues"
,
user
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_
gitlab_
http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
2
)
...
...
@@ -948,19 +939,19 @@ describe API::MergeRequests do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/closes_issues"
,
guest
)
expect
(
response
).
to
have_http_status
(
403
)
expect
(
response
).
to
have_
gitlab_
http_status
(
403
)
end
it
"returns 404 for an invalid merge request IID"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/12345/closes_issues"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
"returns 404 if the merge request id is used instead of iid"
do
get
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/closes_issues"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
end
...
...
@@ -968,26 +959,26 @@ describe API::MergeRequests do
it
'subscribes to a merge request'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/subscribe"
,
admin
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_
gitlab_
http_status
(
201
)
expect
(
json_response
[
'subscribed'
]).
to
eq
(
true
)
end
it
'returns 304 if already subscribed'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/subscribe"
,
user
)
expect
(
response
).
to
have_http_status
(
304
)
expect
(
response
).
to
have_
gitlab_
http_status
(
304
)
end
it
'returns 404 if the merge request is not found'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/123/subscribe"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
'returns 404 if the merge request id is used instead of iid'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/subscribe"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
'returns 403 if user has no access to read code'
do
...
...
@@ -996,7 +987,7 @@ describe API::MergeRequests do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/subscribe"
,
guest
)
expect
(
response
).
to
have_http_status
(
403
)
expect
(
response
).
to
have_
gitlab_
http_status
(
403
)
end
end
...
...
@@ -1004,26 +995,26 @@ describe API::MergeRequests do
it
'unsubscribes from a merge request'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/unsubscribe"
,
user
)
expect
(
response
).
to
have_http_status
(
201
)
expect
(
response
).
to
have_
gitlab_
http_status
(
201
)
expect
(
json_response
[
'subscribed'
]).
to
eq
(
false
)
end
it
'returns 304 if not subscribed'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/unsubscribe"
,
admin
)
expect
(
response
).
to
have_http_status
(
304
)
expect
(
response
).
to
have_
gitlab_
http_status
(
304
)
end
it
'returns 404 if the merge request is not found'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/123/unsubscribe"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
'returns 404 if the merge request id is used instead of iid'
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
id
}
/unsubscribe"
,
user
)
expect
(
response
).
to
have_http_status
(
404
)
expect
(
response
).
to
have_
gitlab_
http_status
(
404
)
end
it
'returns 403 if user has no access to read code'
do
...
...
@@ -1032,7 +1023,7 @@ describe API::MergeRequests do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/unsubscribe"
,
guest
)
expect
(
response
).
to
have_http_status
(
403
)
expect
(
response
).
to
have_
gitlab_
http_status
(
403
)
end
end
...
...
spec/services/create_deployment_service_spec.rb
View file @
ae7c52a0
...
...
@@ -20,6 +20,10 @@ describe CreateDeploymentService do
let
(
:service
)
{
described_class
.
new
(
job
)
}
before
do
allow_any_instance_of
(
Deployment
).
to
receive
(
:create_ref
)
end
describe
'#execute'
do
subject
{
service
.
execute
}
...
...
spec/services/merge_requests/get_urls_service_spec.rb
View file @
ae7c52a0
...
...
@@ -3,7 +3,7 @@ require "spec_helper"
describe
MergeRequests
::
GetUrlsService
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
let
(
:service
)
{
described_class
.
new
(
project
)
}
let
(
:source_branch
)
{
"m
y_branch
"
}
let
(
:source_branch
)
{
"m
erge-test
"
}
let
(
:new_merge_request_url
)
{
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}
/
#{
project
.
namespace
.
name
}
/
#{
project
.
path
}
/merge_requests/new?merge_request%5Bsource_branch%5D=
#{
source_branch
}
"
}
let
(
:show_merge_request_url
)
{
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}
/
#{
project
.
namespace
.
name
}
/
#{
project
.
path
}
/merge_requests/
#{
merge_request
.
iid
}
"
}
let
(
:new_branch_changes
)
{
"
#{
Gitlab
::
Git
::
BLANK_SHA
}
570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/
#{
source_branch
}
"
}
...
...
@@ -111,9 +111,9 @@ describe MergeRequests::GetUrlsService do
end
context
'pushing new branch and existing branch (with merge request created) at once'
do
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
"
existing_branch
"
)
}
let!
(
:merge_request
)
{
create
(
:merge_request
,
source_project:
project
,
source_branch:
"
markdown
"
)
}
let
(
:new_branch_changes
)
{
"
#{
Gitlab
::
Git
::
BLANK_SHA
}
570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/new_branch"
}
let
(
:existing_branch_changes
)
{
"d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/
existing_branch
"
}
let
(
:existing_branch_changes
)
{
"d14d6c0abdd253381df51a723d58691b2ee1ab08 570e7b2abdd848b95f2f578043fc23bd6f6fd24d refs/heads/
markdown
"
}
let
(
:changes
)
{
"
#{
new_branch_changes
}
\n
#{
existing_branch_changes
}
"
}
let
(
:new_merge_request_url
)
{
"http://
#{
Gitlab
.
config
.
gitlab
.
host
}
/
#{
project
.
namespace
.
name
}
/
#{
project
.
path
}
/merge_requests/new?merge_request%5Bsource_branch%5D=new_branch"
}
...
...
@@ -124,7 +124,7 @@ describe MergeRequests::GetUrlsService do
url:
new_merge_request_url
,
new_merge_request:
true
},
{
branch_name:
"
existing_branch
"
,
branch_name:
"
markdown
"
,
url:
show_merge_request_url
,
new_merge_request:
false
}])
...
...
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