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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
933723f8
Commit
933723f8
authored
Apr 15, 2019
by
Brett Walker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extracted EE changes
- discussions_spec.rb - merge_requests_spec.rb - notes_spec.rb
parent
dcba84ce
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
57 deletions
+83
-57
ee/spec/requests/api/discussions_spec.rb
ee/spec/requests/api/discussions_spec.rb
+30
-0
ee/spec/requests/api/merge_requests_spec.rb
ee/spec/requests/api/merge_requests_spec.rb
+23
-0
ee/spec/requests/api/notes_spec.rb
ee/spec/requests/api/notes_spec.rb
+30
-0
spec/requests/api/discussions_spec.rb
spec/requests/api/discussions_spec.rb
+0
-18
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+0
-21
spec/requests/api/notes_spec.rb
spec/requests/api/notes_spec.rb
+0
-18
No files found.
ee/spec/requests/api/discussions_spec.rb
0 → 100644
View file @
933723f8
# frozen_string_literal: true
require
'spec_helper'
describe
API
::
Discussions
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
:repository
,
namespace:
user
.
namespace
)
}
let
(
:private_user
)
{
create
(
:user
)
}
before
do
project
.
add_developer
(
user
)
end
context
'when noteable is an Epic'
do
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:epic
)
{
create
(
:epic
,
group:
group
,
author:
user
)
}
let!
(
:epic_note
)
{
create
(
:discussion_note
,
noteable:
epic
,
project:
project
,
author:
user
)
}
before
do
group
.
add_owner
(
user
)
stub_licensed_features
(
epics:
true
)
end
it_behaves_like
'discussions API'
,
'groups'
,
'epics'
,
'id'
do
let
(
:parent
)
{
group
}
let
(
:noteable
)
{
epic
}
let
(
:note
)
{
epic_note
}
end
end
end
ee/spec/requests/api/merge_requests_spec.rb
View file @
933723f8
...
...
@@ -204,6 +204,29 @@ describe API::MergeRequests do
end
end
describe
"PUT /projects/:id/merge_requests/:merge_request_iid/merge"
do
it
'returns 405 if merge request was not approved'
do
project
.
add_developer
(
create
(
:user
))
project
.
update
(
approvals_before_merge:
1
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
406
)
expect
(
json_response
[
'message'
]).
to
eq
(
'Branch cannot be merged'
)
end
it
'returns 200 if merge request was approved'
do
approver
=
create
(
:user
)
project
.
add_developer
(
approver
)
project
.
update
(
approvals_before_merge:
1
)
merge_request
.
approvals
.
create
(
user:
approver
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
end
context
'when authenticated'
do
def
expect_response_contain_exactly
(
*
items
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
...
...
ee/spec/requests/api/notes_spec.rb
0 → 100644
View file @
933723f8
# frozen_string_literal: true
require
'spec_helper'
describe
API
::
Notes
do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
namespace:
user
.
namespace
)
}
let
(
:private_user
)
{
create
(
:user
)
}
before
do
project
.
add_reporter
(
user
)
end
context
"when noteable is an Epic"
do
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:epic
)
{
create
(
:epic
,
group:
group
,
author:
user
)
}
let!
(
:epic_note
)
{
create
(
:note
,
noteable:
epic
,
project:
project
,
author:
user
)
}
before
do
group
.
add_owner
(
user
)
stub_licensed_features
(
epics:
true
)
end
it_behaves_like
"noteable API"
,
'groups'
,
'epics'
,
'id'
do
let
(
:parent
)
{
group
}
let
(
:noteable
)
{
epic
}
let
(
:note
)
{
epic_note
}
end
end
end
spec/requests/api/discussions_spec.rb
View file @
933723f8
...
...
@@ -31,24 +31,6 @@ describe API::Discussions do
end
end
context
'when noteable is an Epic'
do
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:ext_group
)
{
create
(
:group
,
:public
)
}
let
(
:epic
)
{
create
(
:epic
,
group:
group
,
author:
user
)
}
let!
(
:epic_note
)
{
create
(
:discussion_note
,
noteable:
epic
,
project:
project
,
author:
user
)
}
before
do
group
.
add_owner
(
user
)
stub_licensed_features
(
epics:
true
)
end
it_behaves_like
'discussions API'
,
'groups'
,
'epics'
,
'id'
do
let
(
:parent
)
{
group
}
let
(
:noteable
)
{
epic
}
let
(
:note
)
{
epic_note
}
end
end
context
'when noteable is a Merge Request'
do
let!
(
:noteable
)
{
create
(
:merge_request_with_diffs
,
source_project:
project
,
target_project:
project
,
author:
user
)
}
let!
(
:note
)
{
create
(
:discussion_note_on_merge_request
,
noteable:
noteable
,
project:
project
,
author:
user
)
}
...
...
spec/requests/api/merge_requests_spec.rb
View file @
933723f8
...
...
@@ -1443,27 +1443,6 @@ describe API::MergeRequests do
expect
(
json_response
[
'message'
]).
to
eq
(
'405 Method Not Allowed'
)
end
it
'returns 405 if merge request was not approved'
do
project
.
add_developer
(
create
(
:user
))
project
.
update
(
approvals_before_merge:
1
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
406
)
expect
(
json_response
[
'message'
]).
to
eq
(
'Branch cannot be merged'
)
end
it
'returns 200 if merge request was approved'
do
approver
=
create
(
:user
)
project
.
add_developer
(
approver
)
project
.
update
(
approvals_before_merge:
1
)
merge_request
.
approvals
.
create
(
user:
approver
)
put
api
(
"/projects/
#{
project
.
id
}
/merge_requests/
#{
merge_request
.
iid
}
/merge"
,
user
)
expect
(
response
).
to
have_gitlab_http_status
(
200
)
end
it
"returns 401 if user has no permissions to merge"
do
user2
=
create
(
:user
)
project
.
add_reporter
(
user2
)
...
...
spec/requests/api/notes_spec.rb
View file @
933723f8
...
...
@@ -182,22 +182,4 @@ describe API::Notes do
end
end
end
context
"when noteable is an Epic"
do
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:ext_group
)
{
create
(
:group
,
:public
)
}
let
(
:epic
)
{
create
(
:epic
,
group:
group
,
author:
user
)
}
let!
(
:epic_note
)
{
create
(
:note
,
noteable:
epic
,
project:
project
,
author:
user
)
}
before
do
group
.
add_owner
(
user
)
stub_licensed_features
(
epics:
true
)
end
it_behaves_like
"noteable API"
,
'groups'
,
'epics'
,
'id'
do
let
(
:parent
)
{
group
}
let
(
:noteable
)
{
epic
}
let
(
:note
)
{
epic_note
}
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