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
Jérome Perrin
gitlab-ce
Commits
72053703
Commit
72053703
authored
Aug 01, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix API repository specs
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
0082cfb1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
spec/requests/api/repositories_spec.rb
spec/requests/api/repositories_spec.rb
+12
-9
spec/support/repo_helpers.rb
spec/support/repo_helpers.rb
+1
-0
No files found.
spec/requests/api/repositories_spec.rb
View file @
72053703
...
...
@@ -3,6 +3,8 @@ require 'mime/types'
describe
API
::
API
,
api:
true
do
include
ApiHelpers
include
RepoHelpers
let
(
:user
)
{
create
(
:user
)
}
let
(
:user2
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
creator_id:
user
.
id
)
}
...
...
@@ -29,6 +31,7 @@ describe API::API, api: true do
response
.
status
.
should
==
201
json_response
[
'name'
].
should
==
'v1.0.0'
end
it
'should deny for user without push access'
do
post
api
(
"/projects/
#{
project
.
id
}
/repository/tags"
,
user2
),
tag_name:
'v1.0.0'
,
...
...
@@ -47,7 +50,7 @@ describe API::API, api: true do
response
.
status
.
should
==
200
json_response
.
should
be_an
Array
json_response
.
first
[
'name'
].
should
==
'
app
'
json_response
.
first
[
'name'
].
should
==
'
encoding
'
json_response
.
first
[
'type'
].
should
==
'tree'
json_response
.
first
[
'mode'
].
should
==
'040000'
end
...
...
@@ -92,7 +95,7 @@ describe API::API, api: true do
describe
"GET /projects/:id/repository/raw_blobs/:sha"
do
it
"should get the raw file contents"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/raw_blobs/
d1aff2896d99d7acc4d9780fbb716b113c45ecf7
"
,
user
)
get
api
(
"/projects/
#{
project
.
id
}
/repository/raw_blobs/
#{
sample_blob
.
oid
}
"
,
user
)
response
.
status
.
should
==
200
end
end
...
...
@@ -130,21 +133,21 @@ describe API::API, api: true do
describe
'GET /projects/:id/repository/compare'
do
it
"should compare branches"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/compare"
,
user
),
from:
'master'
,
to:
'
simple_merge_request
'
get
api
(
"/projects/
#{
project
.
id
}
/repository/compare"
,
user
),
from:
'master'
,
to:
'
feature
'
response
.
status
.
should
==
200
json_response
[
'commits'
].
should
be_present
json_response
[
'diffs'
].
should
be_present
end
it
"should compare tags"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/compare"
,
user
),
from:
'v1.0.
1'
,
to:
'v1.0.2
'
get
api
(
"/projects/
#{
project
.
id
}
/repository/compare"
,
user
),
from:
'v1.0.
0'
,
to:
'v1.1.0
'
response
.
status
.
should
==
200
json_response
[
'commits'
].
should
be_present
json_response
[
'diffs'
].
should
be_present
end
it
"should compare commits"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/compare"
,
user
),
from:
'b1e6a9dbf1c85'
,
to:
'1e689bfba395'
get
api
(
"/projects/
#{
project
.
id
}
/repository/compare"
,
user
),
from:
sample_commit
.
id
,
to:
sample_commit
.
parent_id
response
.
status
.
should
==
200
json_response
[
'commits'
].
should
be_empty
json_response
[
'diffs'
].
should
be_empty
...
...
@@ -152,7 +155,7 @@ describe API::API, api: true do
end
it
"should compare commits in reverse order"
do
get
api
(
"/projects/
#{
project
.
id
}
/repository/compare"
,
user
),
from:
'1e689bfba395'
,
to:
'b1e6a9dbf1c85'
get
api
(
"/projects/
#{
project
.
id
}
/repository/compare"
,
user
),
from:
sample_commit
.
parent_id
,
to:
sample_commit
.
id
response
.
status
.
should
==
200
json_response
[
'commits'
].
should
be_present
json_response
[
'diffs'
].
should
be_present
...
...
@@ -175,9 +178,9 @@ describe API::API, api: true do
contributor
=
json_response
.
first
contributor
[
'email'
].
should
==
'dmitriy.zaporozhets@gmail.com'
contributor
[
'name'
].
should
==
'Dmitriy Zaporozhets'
contributor
[
'commits'
].
should
==
1
85
contributor
[
'additions'
].
should
==
66072
contributor
[
'deletions'
].
should
==
63013
contributor
[
'commits'
].
should
==
1
3
contributor
[
'additions'
].
should
==
4081
contributor
[
'deletions'
].
should
==
29
end
end
end
spec/support/repo_helpers.rb
View file @
72053703
...
...
@@ -13,6 +13,7 @@ module RepoHelpers
#
def
sample_blob
OpenStruct
.
new
(
oid:
'5f53439ca4b009096571d3c8bc3d09d30e7431b3'
,
path:
"files/js/commit.js.coffee"
,
data:
<<
eos
class Commit
...
...
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