| ... | @@ -78,4 +78,38 @@ describe API::API do |
... | @@ -78,4 +78,38 @@ describe API::API do |
|
|
response.status.should == 400
|
|
response.status.should == 400
|
|
|
end
|
|
end
|
|
|
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 |
|
end |