Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

add Octokit.delete_ref method and specs

  • Loading branch information...
commit 37cee2c02c7118bfef65fdc74d0ce17f13eecb6d 1 parent 0fa04be
@carvil carvil authored
Showing with 23 additions and 0 deletions.
  1. +12 −0 lib/octokit/client/refs.rb
  2. +11 −0 spec/octokit/client/refs_spec.rb
View
12 lib/octokit/client/refs.rb
@@ -65,6 +65,18 @@ def update_ref(repo, ref, sha, force=true, options={})
patch("repos/#{Repository.new(repo)}/git/refs/#{ref}", options.merge(parameters))
end
+ # Delete a single reference
+ #
+ # @param repo [String, Repository, Hash] A GitHub repository
+ # @param ref [String] The ref, e.g. <tt>tags/v0.0.3</tt>
+ # @return [Response] A response object with status
+ # @see http://developer.github.com/v3/git/refs/
+ # @example Delete tags/v0.0.3 for sferik/rails_admin
+ # Octokit.delete_ref("sferik/rails_admin","tags/v0.0.3")
+ def delete_ref(repo, ref, options={})
+ delete("/repos/#{Repository.new(repo)}/git/refs/#{ref}", options, 3, true, true)
+ end
+
end
end
end
View
11 spec/octokit/client/refs_spec.rb
@@ -64,5 +64,16 @@
end
end
+ describe ".delete_ref" do
+
+ it "should delete an existing ref" do
+ stub_delete("/repos/octocat/Hello-World/git/refs/heads/feature-a").
+ to_return(:status => 204)
+ ref = @client.delete_ref("octocat/Hello-World", "heads/feature-a")
+ ref.status.should == 204
+ end
+
+ end
+
end
Please sign in to comment.
Something went wrong with that request. Please try again.