forked from Ermlab/nxt-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmock.js
More file actions
117 lines (108 loc) · 2.99 KB
/
mock.js
File metadata and controls
117 lines (108 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// Generated by CoffeeScript 1.7.1
(function() {
var Mock,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
Mock = (function() {
function Mock() {
this.beforeEach = __bind(this.beforeEach, this);
this.update_path = __bind(this.update_path, this);
this.setup = __bind(this.setup, this);
var project;
this.path = '';
this.projects = [];
project = {
id: 13,
description: '',
default_branch: 'master',
"public": false,
visibility_level: 0,
ssh_url_to_repo: 'git@demo.gitlab.com:sandbox/afro.git',
http_url_to_repo: 'http://demo.gitlab.com/sandbox/afro.git',
web_url: 'http://demo.gitlab.com/sandbox/afro',
owner: {
id: 8,
name: 'Sandbox',
created_at: '2013-08-01T16:44:17.000Z'
},
name: 'Afro',
name_with_namespace: 'Sandbox / Afro',
path: 'afro',
path_with_namespace: 'sandbox/afro',
issues_enabled: true,
merge_requests_enabled: true,
wall_enabled: false,
wiki_enabled: true,
snippets_enabled: false,
created_at: '2013-11-14T17:45:19.000Z',
last_activity_at: '2014-01-16T15:32:07.000Z',
namespace: {
id: 8,
name: 'Sandbox',
path: 'sandbox',
owner_id: 1,
created_at: '2013-08-01T16:44:17.000Z',
updated_at: '2013-08-01T16:44:17.000Z',
description: ''
}
};
this.projects.push(project);
}
Mock.prototype.setup = function(gitlab) {
before((function(_this) {
return function() {
return gitlab.slumber = function(path) {
return _this.update_path(path);
};
};
})(this));
return beforeEach((function(_this) {
return function() {
return _this.beforeEach();
};
})(this));
};
Mock.prototype.update_path = function(path) {
this.path = path;
return this;
};
Mock.prototype.defaults = {
get: function(opts, cb) {
if (cb) {
return cb(null, {}, [{}]);
}
},
"delete": function(opts, cb) {
if (cb) {
return cb(null, {}, [{}]);
}
},
post: function(opts, cb) {
if (cb) {
return cb(null, {}, [{}]);
}
},
put: function(opts, cb) {
if (cb) {
return cb(null, {}, [{}]);
}
},
patch: function(opts, cb) {
if (cb) {
return cb(null, {}, [{}]);
}
}
};
Mock.prototype.beforeEach = function() {
var method, _i, _len, _ref, _results;
_ref = ['get', 'delete', 'post', 'put', 'patch'];
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
method = _ref[_i];
_results.push(this[method] = this.defaults[method]);
}
return _results;
};
return Mock;
})();
module.exports = new Mock();
}).call(this);