Wrap ref creation in elixir

This commit is contained in:
Carlos Martín Nieto
2013-09-04 01:16:50 +02:00
parent ee1d719ef4
commit 72078cb099
3 changed files with 50 additions and 0 deletions

36
test/reference_test.exs Normal file
View File

@@ -0,0 +1,36 @@
Code.require_file "../test_helper.exs", __FILE__
defmodule ReferenceTest do
use ExUnit.Case
use Geef
import RepoHelpers
setup do
{{:ok, repo}, path} = tmp_bare()
{:ok, [repo: repo, path: path]}
end
teardown meta do
Repository.stop(meta[:repo])
File.rm_rf!(meta[:path])
:ok
end
test "creating and looking up", meta do
repo = meta[:repo]
{ :ok, odb } = Repository.odb(repo)
content = "I'm some content"
{:ok, id} = Odb.write(odb, content, :blob)
refname = "refs/tags/foo"
{:ok, ref} = Reference.create(repo, refname, id)
{:ok, looked_up} = Reference.lookup(repo, refname)
ref == looked_up
refname = "refs/tags/foo2"
{:ok, ref} = Reference.create_symbolic(repo, refname, id)
{:ok, looked_up} = Reference.lookup(repo, refname)
ref == looked_up
end
end