UNPKG

1.71 kBtext/coffeescriptView Raw
1
2should = require 'should'
3mecano = if process.env.MECANO_COV then require '../lib-cov/mecano' else require '../lib/mecano'
4test = require './test'
5
6describe 'git', ->
7
8 scratch = test.scratch @
9
10 beforeEach (next) ->
11 mecano.extract
12 source: "#{__dirname}/../resources/repo.git.zip"
13 destination: "#{scratch}"
14 , next
15
16 # it 'should init new repo over existing directory', (next) ->
17 # mecano.git
18 # source: "#{__dirname}/../resources/repo.git"
19 # destination: "#{scratch}"
20 # , (err, updated) ->
21 # updated.should.eql 1
22 # mecano.git
23 # source: "#{__dirname}/../resources/repo.git"
24 # destination: "#{scratch}"
25 # , (err, updated) ->
26 # updated.should.eql 0
27 # next()
28
29 it 'should clone repo into new dir', (next) ->
30 mecano.git
31 source: "#{scratch}/repo.git"
32 destination: "#{scratch}/my_repo"
33 , (err, updated) ->
34 should.not.exist err
35 updated.should.eql 1
36 mecano.git
37 source: "#{scratch}/repo.git"
38 destination: "#{scratch}/my_repo"
39 , (err, updated) ->
40 updated.should.eql 0
41 next()
42
43 it 'should honore revision', (next) ->
44 mecano.git
45 source: "#{scratch}/repo.git"
46 destination: "#{scratch}/my_repo"
47 , (err, updated) ->
48 should.not.exist err
49 mecano.git
50 source: "#{scratch}/repo.git"
51 destination: "#{scratch}/my_repo"
52 revision: 'v0.0.1'
53 , (err, updated) ->
54 updated.should.eql 1
55 mecano.git
56 source: "#{scratch}/repo.git"
57 destination: "#{scratch}/my_repo"
58 revision: 'v0.0.1'
59 , (err, updated) ->
60 updated.should.eql 0
61 next()
62