From 68aebb76b24972b7d00a78f3d4f923fca009ba31 Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Wed, 21 May 2014 12:32:20 +0500 Subject: [PATCH] ability to delete a project close #32 --- lib/gitlab/client/projects.rb | 11 +++++++++++ spec/gitlab/client/projects_spec.rb | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/lib/gitlab/client/projects.rb b/lib/gitlab/client/projects.rb index ce6901194..4ddbceab9 100644 --- a/lib/gitlab/client/projects.rb +++ b/lib/gitlab/client/projects.rb @@ -55,6 +55,17 @@ def create_project(name, options={}) post(url, :body => {:name => name}.merge(options)) end + # Deletes a project. + # + # @example + # Gitlab.delete_project(4) + # + # @param [Integer, String] id The ID or name of a project. + # @return [Gitlab::ObjectifiedHash] Information about deleted project. + def delete_project(id) + delete("/projects/#{id}") + end + # Gets a list of project team members. # # @example diff --git a/spec/gitlab/client/projects_spec.rb b/spec/gitlab/client/projects_spec.rb index ca36de866..78adc163b 100644 --- a/spec/gitlab/client/projects_spec.rb +++ b/spec/gitlab/client/projects_spec.rb @@ -64,6 +64,22 @@ end end + describe ".delete_project" do + before do + stub_delete("/projects/Gitlab", "project") + @project = Gitlab.delete_project('Gitlab') + end + + it "should get the correct resource" do + expect(a_delete("/projects/Gitlab")).to have_been_made + end + + it "should return information about a created project" do + expect(@project.name).to eq("Gitlab") + expect(@project.owner.name).to eq("John Smith") + end + end + describe ".team_members" do before do stub_get("/projects/3/members", "team_members")