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
cee68dec
Commit
cee68dec
authored
Jan 22, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix api merge request specs
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
c227aa44
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
17 deletions
+16
-17
spec/requests/api/merge_requests_spec.rb
spec/requests/api/merge_requests_spec.rb
+16
-17
No files found.
spec/requests/api/merge_requests_spec.rb
View file @
cee68dec
...
@@ -47,32 +47,32 @@ describe API::API do
...
@@ -47,32 +47,32 @@ describe API::API do
context
'between branches projects'
do
context
'between branches projects'
do
it
"should return merge_request"
do
it
"should return merge_request"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
'Test merge_request'
,
source_branch:
"stable"
,
target_branch:
"master"
,
author:
user
title:
'Test merge_request'
,
source_branch:
"stable"
,
target_branch:
"master"
,
author:
user
response
.
status
.
should
==
201
response
.
status
.
should
==
201
json_response
[
'title'
].
should
==
'Test merge_request'
json_response
[
'title'
].
should
==
'Test merge_request'
end
end
it
"should return 422 when source_branch equals target_branch"
do
it
"should return 422 when source_branch equals target_branch"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
"Test merge_request"
,
source_branch:
"master"
,
target_branch:
"master"
,
author:
user
title:
"Test merge_request"
,
source_branch:
"master"
,
target_branch:
"master"
,
author:
user
response
.
status
.
should
==
422
response
.
status
.
should
==
422
end
end
it
"should return 400 when source_branch is missing"
do
it
"should return 400 when source_branch is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
"Test merge_request"
,
target_branch:
"master"
,
author:
user
title:
"Test merge_request"
,
target_branch:
"master"
,
author:
user
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
it
"should return 400 when target_branch is missing"
do
it
"should return 400 when target_branch is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
"Test merge_request"
,
source_branch:
"stable"
,
author:
user
title:
"Test merge_request"
,
source_branch:
"stable"
,
author:
user
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
it
"should return 400 when title is missing"
do
it
"should return 400 when title is missing"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
target_branch:
'master'
,
source_branch:
'stable'
target_branch:
'master'
,
source_branch:
'stable'
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
end
end
...
@@ -80,8 +80,8 @@ describe API::API do
...
@@ -80,8 +80,8 @@ describe API::API do
context
'forked projects'
do
context
'forked projects'
do
let!
(
:user2
)
{
create
(
:user
)}
let!
(
:user2
)
{
create
(
:user
)}
let!
(
:forked_project_link
)
{
build
(
:forked_project_link
)
}
let!
(
:forked_project_link
)
{
build
(
:forked_project_link
)
}
let!
(
:fork_project
)
{
create
(
:
source_
project
,
forked_project_link:
forked_project_link
,
namespace:
user2
.
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:fork_project
)
{
create
(
:project
,
forked_project_link:
forked_project_link
,
namespace:
user2
.
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:unrelated_project
)
{
create
(
:
target_project
,
namespace:
user2
.
namespace
,
creator_id:
user2
.
id
)
}
let!
(
:unrelated_project
)
{
create
(
:
project
,
namespace:
create
(
:user
)
.
namespace
,
creator_id:
user2
.
id
)
}
before
:each
do
|
each
|
before
:each
do
|
each
|
fork_project
.
team
<<
[
user2
,
:reporters
]
fork_project
.
team
<<
[
user2
,
:reporters
]
...
@@ -92,7 +92,7 @@ describe API::API do
...
@@ -92,7 +92,7 @@ describe API::API do
it
"should return merge_request"
do
it
"should return merge_request"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
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
title:
'Test merge_request'
,
source_branch:
"stable"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
response
.
status
.
should
==
201
response
.
status
.
should
==
201
json_response
[
'title'
].
should
==
'Test merge_request'
json_response
[
'title'
].
should
==
'Test merge_request'
end
end
...
@@ -102,44 +102,44 @@ describe API::API do
...
@@ -102,44 +102,44 @@ describe API::API do
fork_project
.
forked?
.
should
be_true
fork_project
.
forked?
.
should
be_true
fork_project
.
forked_from_project
.
should
==
project
fork_project
.
forked_from_project
.
should
==
project
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
source_branch:
"master"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
title:
'Test merge_request'
,
source_branch:
"master"
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
response
.
status
.
should
==
201
response
.
status
.
should
==
201
json_response
[
'title'
].
should
==
'Test merge_request'
json_response
[
'title'
].
should
==
'Test merge_request'
end
end
it
"should return 400 when source_branch is missing"
do
it
"should return 400 when source_branch is missing"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
title:
'Test merge_request'
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
it
"should return 400 when target_branch is missing"
do
it
"should return 400 when target_branch is missing"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
title:
'Test merge_request'
,
target_branch:
"master"
,
author:
user2
,
target_project_id:
project
.
id
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
it
"should return 400 when title is missing"
do
it
"should return 400 when title is missing"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
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:
'stable'
,
author:
user2
,
target_project_id:
project
.
id
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
it
"should return 400 when target_branch is specified and not a forked project"
do
it
"should return 400 when target_branch is specified and not a forked project"
do
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
post
api
(
"/projects/
#{
project
.
id
}
/merge_requests"
,
user
),
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'stable'
,
author:
user
,
target_project_id:
fork_project
.
id
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'stable'
,
author:
user
,
target_project_id:
fork_project
.
id
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
it
"should return 400 when target_branch is specified and for a different fork"
do
it
"should return 400 when target_branch is specified and for a different fork"
do
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
post
api
(
"/projects/
#{
fork_project
.
id
}
/merge_requests"
,
user2
),
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'stable'
,
author:
user2
,
target_project_id:
unrelated_project
.
id
title:
'Test merge_request'
,
target_branch:
'master'
,
source_branch:
'stable'
,
author:
user2
,
target_project_id:
unrelated_project
.
id
response
.
status
.
should
==
400
response
.
status
.
should
==
400
end
end
it
"should return 201 when target_branch is specified and for the same project"
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
),
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:
'stable'
,
author:
user2
,
target_project_id:
fork_project
.
id
response
.
status
.
should
==
201
response
.
status
.
should
==
201
end
end
end
end
...
@@ -170,7 +170,7 @@ describe API::API do
...
@@ -170,7 +170,7 @@ describe API::API do
it
"should return 422 when source_branch and target_branch are renamed the same"
do
it
"should return 422 when source_branch and target_branch are renamed the same"
do
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
put
api
(
"/projects/
#{
project
.
id
}
/merge_request/
#{
merge_request
.
id
}
"
,
user
),
source_branch:
"master"
,
target_branch:
"master"
source_branch:
"master"
,
target_branch:
"master"
response
.
status
.
should
==
422
response
.
status
.
should
==
422
end
end
...
@@ -198,5 +198,4 @@ describe API::API do
...
@@ -198,5 +198,4 @@ describe API::API do
response
.
status
.
should
==
404
response
.
status
.
should
==
404
end
end
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