2012-02-15 15:51:45 +01:00
|
|
|
should = require 'should'
|
|
|
|
git = require '../src'
|
|
|
|
Repo = require '../src/repo'
|
2013-09-23 18:20:31 +02:00
|
|
|
fs = require "fs"
|
2013-09-23 18:19:19 +02:00
|
|
|
{exec} = require 'child_process'
|
2012-02-15 15:51:45 +01:00
|
|
|
|
|
|
|
describe "git", ->
|
|
|
|
describe "()", ->
|
|
|
|
repo = git "#{__dirname}/fixtures/simple"
|
|
|
|
it "returns a Repo", ->
|
|
|
|
repo.should.be.an.instanceof Repo
|
2013-09-23 18:19:19 +02:00
|
|
|
|
2013-09-23 18:20:31 +02:00
|
|
|
describe "init()", ->
|
|
|
|
repo = null
|
|
|
|
newRepositoryDir = "#{__dirname}/fixtures/new"
|
|
|
|
before (done) ->
|
|
|
|
fs.mkdirSync newRepositoryDir
|
|
|
|
git.init newRepositoryDir, (err, _repo) ->
|
|
|
|
repo = _repo
|
|
|
|
done err
|
|
|
|
it "inits a Repo", ->
|
|
|
|
repo.should.be.an.instanceof Repo
|
|
|
|
bare = repo.bare || false
|
|
|
|
bare.should.be.false
|
|
|
|
after (done) ->
|
|
|
|
exec "rm -rf #{newRepositoryDir}", done
|
|
|
|
|
|
|
|
describe "init() bare", ->
|
|
|
|
repo = null
|
|
|
|
newRepositoryDir = "#{__dirname}/fixtures/bare"
|
|
|
|
before (done) ->
|
|
|
|
fs.mkdirSync newRepositoryDir
|
|
|
|
git.init newRepositoryDir, true, (err, _repo) ->
|
|
|
|
repo = _repo
|
|
|
|
done err
|
|
|
|
it "inits a bare Repo", ->
|
|
|
|
repo.should.be.an.instanceof Repo
|
|
|
|
bare = repo.bare || false
|
|
|
|
bare.should.be.true
|
|
|
|
after (done) ->
|
|
|
|
exec "rm -rf #{newRepositoryDir}", done
|
|
|
|
|
2013-09-23 18:19:19 +02:00
|
|
|
describe "clone()", ->
|
|
|
|
@timeout 30000
|
|
|
|
repo = null
|
|
|
|
newRepositoryDir = "#{__dirname}/fixtures/clone"
|
|
|
|
before (done) ->
|
2013-10-12 13:46:45 +02:00
|
|
|
git.clone "https://github.com/notatestuser/gift.git", newRepositoryDir, (err, _repo) ->
|
2013-09-23 18:19:19 +02:00
|
|
|
repo = _repo
|
|
|
|
done err
|
|
|
|
it "clone a repository", (done) ->
|
|
|
|
repo.should.be.an.instanceof Repo
|
|
|
|
repo.remote_list (err, remotes) ->
|
|
|
|
remotes.should.have.length 1
|
|
|
|
done()
|
|
|
|
after (done) ->
|
2014-02-08 20:51:01 +01:00
|
|
|
exec "rm -rf #{newRepositoryDir}", done
|