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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
3a63c005
Commit
3a63c005
authored
Aug 11, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix file api tests
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
b9b9fe70
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
22 deletions
+8
-22
spec/requests/api/files_spec.rb
spec/requests/api/files_spec.rb
+8
-22
No files found.
spec/requests/api/files_spec.rb
View file @
3a63c005
...
...
@@ -49,9 +49,7 @@ describe API::API, api: true do
end
it
"should create a new file in project repo"
do
Gitlab
::
Satellite
::
NewFileAction
.
any_instance
.
stub
(
commit!:
true
,
)
expect_any_instance_of
(
Gitlab
::
Satellite
::
NewFileAction
).
to
receive
(
:commit!
).
and_return
(
true
)
post
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
201
)
...
...
@@ -64,9 +62,7 @@ describe API::API, api: true do
end
it
"should return a 400 if satellite fails to create file"
do
Gitlab
::
Satellite
::
NewFileAction
.
any_instance
.
stub
(
commit!:
false
,
)
expect_any_instance_of
(
Gitlab
::
Satellite
::
NewFileAction
).
to
receive
(
:commit!
).
and_return
(
false
)
post
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
400
)
...
...
@@ -84,9 +80,7 @@ describe API::API, api: true do
end
it
"should update existing file in project repo"
do
Gitlab
::
Satellite
::
EditFileAction
.
any_instance
.
stub
(
commit!:
true
,
)
expect_any_instance_of
(
Gitlab
::
Satellite
::
EditFileAction
).
to
receive
(
:commit!
).
and_return
(
true
)
put
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
200
)
...
...
@@ -99,8 +93,7 @@ describe API::API, api: true do
end
it
'should return a 400 if the checkout fails'
do
Gitlab
::
Satellite
::
EditFileAction
.
any_instance
.
stub
(
:commit!
)
.
and_raise
(
Gitlab
::
Satellite
::
CheckoutFailed
)
expect_any_instance_of
(
Gitlab
::
Satellite
::
EditFileAction
).
to
receive
(
:commit!
).
and_raise
(
Gitlab
::
Satellite
::
CheckoutFailed
)
put
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
400
)
...
...
@@ -110,8 +103,7 @@ describe API::API, api: true do
end
it
'should return a 409 if the file was not modified'
do
Gitlab
::
Satellite
::
EditFileAction
.
any_instance
.
stub
(
:commit!
)
.
and_raise
(
Gitlab
::
Satellite
::
CommitFailed
)
expect_any_instance_of
(
Gitlab
::
Satellite
::
EditFileAction
).
to
receive
(
:commit!
).
and_raise
(
Gitlab
::
Satellite
::
CommitFailed
)
put
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
409
)
...
...
@@ -119,8 +111,7 @@ describe API::API, api: true do
end
it
'should return a 409 if the push fails'
do
Gitlab
::
Satellite
::
EditFileAction
.
any_instance
.
stub
(
:commit!
)
.
and_raise
(
Gitlab
::
Satellite
::
PushFailed
)
expect_any_instance_of
(
Gitlab
::
Satellite
::
EditFileAction
).
to
receive
(
:commit!
).
and_raise
(
Gitlab
::
Satellite
::
PushFailed
)
put
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
409
)
...
...
@@ -138,10 +129,7 @@ describe API::API, api: true do
end
it
"should delete existing file in project repo"
do
Gitlab
::
Satellite
::
DeleteFileAction
.
any_instance
.
stub
(
commit!:
true
,
)
expect_any_instance_of
(
Gitlab
::
Satellite
::
DeleteFileAction
).
to
receive
(
:commit!
).
and_return
(
true
)
delete
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'file_path'
]).
to
eq
(
file_path
)
...
...
@@ -153,9 +141,7 @@ describe API::API, api: true do
end
it
"should return a 400 if satellite fails to create file"
do
Gitlab
::
Satellite
::
DeleteFileAction
.
any_instance
.
stub
(
commit!:
false
,
)
expect_any_instance_of
(
Gitlab
::
Satellite
::
DeleteFileAction
).
to
receive
(
:commit!
).
and_return
(
false
)
delete
api
(
"/projects/
#{
project
.
id
}
/repository/files"
,
user
),
valid_params
expect
(
response
.
status
).
to
eq
(
400
)
...
...
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