Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add tests for `Rugged::Branch#tip`, `Rugged::Repository.delete` and `…

…Rugged::Repository.move`.
  • Loading branch information...
commit 557caaf9b2077e1fe3fdb71559ff4011efc30474 1 parent 8839c7d
@arthurschreiber authored
Showing with 42 additions and 0 deletions.
  1. +42 −0 test/branch_test.rb
View
42 test/branch_test.rb
@@ -29,6 +29,20 @@
end
end
+context "Rugged::Branch#tip" do
+ setup do
+ @path = temp_repo("testrepo.git")
+ @repo = Rugged::Repository.new(@path)
+ end
+
+ test "returns the latest commit of the branch" do
+ tip = Rugged::Branch.lookup(@repo, "master").tip
+
+ assert_kind_of Rugged::Commit, tip
+ assert_equal "36060c58702ed4c2a40832c51758d5344201d89a", tip.oid
+ end
+end
+
context "Rugged::Branch.lookup" do
setup do
@path = temp_repo("testrepo.git")
@@ -82,6 +96,34 @@
end
end
+context "Rugged::Repository.delete" do
+ setup do
+ @path = temp_repo("testrepo.git")
+ @repo = Rugged::Repository.new(@path)
+ end
+
+ test "deletes a branch from the repository" do
+ @repo.create_branch("test_branch")
+ Rugged::Branch.delete(@repo, "test_branch")
+ assert_nil Rugged::Branch.lookup(@repo, "test_branch")
+ end
+end
+
+context "Rugged::Repository.move" do
+ setup do
+ @path = temp_repo("testrepo.git")
+ @repo = Rugged::Repository.new(@path)
+ end
+
+ test "renames a branch" do
+ @repo.create_branch("test_branch")
+
+ Rugged::Branch.move(@repo, "test_branch", "other_branch")
+ assert_nil Rugged::Branch.lookup(@repo, "test_branch")
+ refute_nil Rugged::Branch.lookup(@repo, "other_branch")
+ end
+end
+
context "Rugged::Repository#create_branch" do
setup do
@path = temp_repo("testrepo.git")
Please sign in to comment.
Something went wrong with that request. Please try again.