1 | var fs = require('fs');
|
2 | var path = require('path');
|
3 |
|
4 | var helper = require('./helper');
|
5 |
|
6 | var assert = helper.assert;
|
7 |
|
8 | describe('multitask', function() {
|
9 | var fixture, repo1, repo2;
|
10 |
|
11 | before(function(done) {
|
12 | this.timeout(3000);
|
13 | helper.buildFixture('multitask', function(error, dir) {
|
14 | fixture = dir;
|
15 | repo1 = path.join(fixture, '.grunt/grunt-gh-pages/gh-pages/first');
|
16 | repo2 = path.join(fixture, '.grunt/grunt-gh-pages/gh-pages/second');
|
17 | done(error);
|
18 | });
|
19 | });
|
20 |
|
21 | after(function(done) {
|
22 | helper.afterFixture(fixture, done);
|
23 | });
|
24 |
|
25 | it('creates .grunt/grunt-gh-pages/gh-pages/first directory', function(done) {
|
26 | fs.stat(repo1, function(error, stats) {
|
27 | assert.isTrue(!error, 'no error');
|
28 | assert.isTrue(stats.isDirectory(), 'directory');
|
29 | done(error);
|
30 | });
|
31 | });
|
32 |
|
33 | it('creates .grunt/grunt-gh-pages/gh-pages/second directory', function(done) {
|
34 | fs.stat(repo2, function(error, stats) {
|
35 | assert.isTrue(!error, 'no error');
|
36 | assert.isTrue(stats.isDirectory(), 'directory');
|
37 | done(error);
|
38 | });
|
39 | });
|
40 |
|
41 | it('pushes the gh-pages branch to remote', function(done) {
|
42 | helper.git(['ls-remote', '--exit-code', '.', 'origin/gh-pages'], repo1)
|
43 | .then(function() {
|
44 | done();
|
45 | })
|
46 | .fail(done);
|
47 | });
|
48 |
|
49 | it('pushes the branch-two branch to remote', function(done) {
|
50 | helper.git(['ls-remote', '--exit-code', '.', 'origin/branch-two'], repo2)
|
51 | .then(function() {
|
52 | done();
|
53 | })
|
54 | .fail(done);
|
55 | });
|
56 |
|
57 | });
|