Skip to content

Commit

Permalink
Add tests for Rugged::Branch#tip, Rugged::Repository.delete and `…
Browse files Browse the repository at this point in the history
…Rugged::Repository.move`.
  • Loading branch information
arthurschreiber committed Aug 7, 2012
1 parent 8839c7d commit 557caaf
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/branch_test.rb
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 557caaf

Please sign in to comment.