Skip to content
Snippets Groups Projects
Unverified Commit a185cce5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Tests for delete file by API

parent 32d7332d
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -78,4 +78,38 @@ describe API::API do
response.status.should == 400
end
end
describe "DELETE /projects/:id/repository/files" do
let(:valid_params) {
{
file_path: 'spec/spec_helper.rb',
branch_name: 'master',
commit_message: 'Changed file'
}
}
it "should delete existing file in project repo" do
Gitlab::Satellite::DeleteFileAction.any_instance.stub(
commit!: true,
)
delete api("/projects/#{project.id}/repository/files", user), valid_params
response.status.should == 200
json_response['file_path'].should == 'spec/spec_helper.rb'
end
it "should return a 400 bad request if no params given" do
delete api("/projects/#{project.id}/repository/files", user)
response.status.should == 400
end
it "should return a 400 if satellite fails to create file" do
Gitlab::Satellite::DeleteFileAction.any_instance.stub(
commit!: false,
)
delete api("/projects/#{project.id}/repository/files", user), valid_params
response.status.should == 400
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment