oojspec 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/javascripts/oojspec/runner.js.coffee +14 -7
- data/lib/oojspec/version.rb +1 -1
- data/vendor/assets/javascripts/buster/all.js.coffee +2 -0
- data/vendor/assets/javascripts/buster/bane.js +174 -0
- data/vendor/assets/javascripts/buster/buster-core.js +6 -5
- data/vendor/assets/javascripts/buster/expect.js +39 -35
- data/vendor/assets/javascripts/buster/formatio.js +215 -0
- data/vendor/assets/javascripts/buster/lodash.js +5163 -0
- data/vendor/assets/javascripts/buster/referee.js +692 -0
- data/vendor/assets/javascripts/buster/samsam.js +399 -0
- metadata +8 -5
- data/vendor/assets/javascripts/buster/buster-assertions.js +0 -782
- data/vendor/assets/javascripts/buster/buster-format.js +0 -199
@@ -1,199 +0,0 @@
|
|
1
|
-
if (typeof buster === "undefined") {
|
2
|
-
var buster = {};
|
3
|
-
}
|
4
|
-
|
5
|
-
if (typeof module === "object" && typeof require === "function") {
|
6
|
-
buster = require("buster-core");
|
7
|
-
}
|
8
|
-
|
9
|
-
buster.format = buster.format || {};
|
10
|
-
buster.format.excludeConstructors = ["Object", /^.$/];
|
11
|
-
buster.format.quoteStrings = true;
|
12
|
-
|
13
|
-
buster.format.ascii = (function () {
|
14
|
-
"use strict";
|
15
|
-
|
16
|
-
var hasOwn = Object.prototype.hasOwnProperty;
|
17
|
-
|
18
|
-
var specialObjects = [];
|
19
|
-
if (typeof global != "undefined") {
|
20
|
-
specialObjects.push({ obj: global, value: "[object global]" });
|
21
|
-
}
|
22
|
-
if (typeof document != "undefined") {
|
23
|
-
specialObjects.push({ obj: document, value: "[object HTMLDocument]" });
|
24
|
-
}
|
25
|
-
if (typeof window != "undefined") {
|
26
|
-
specialObjects.push({ obj: window, value: "[object Window]" });
|
27
|
-
}
|
28
|
-
|
29
|
-
function keys(object) {
|
30
|
-
var k = Object.keys && Object.keys(object) || [];
|
31
|
-
|
32
|
-
if (k.length == 0) {
|
33
|
-
for (var prop in object) {
|
34
|
-
if (hasOwn.call(object, prop)) {
|
35
|
-
k.push(prop);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
return k.sort();
|
41
|
-
}
|
42
|
-
|
43
|
-
function isCircular(object, objects) {
|
44
|
-
if (typeof object != "object") {
|
45
|
-
return false;
|
46
|
-
}
|
47
|
-
|
48
|
-
for (var i = 0, l = objects.length; i < l; ++i) {
|
49
|
-
if (objects[i] === object) {
|
50
|
-
return true;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
|
-
return false;
|
55
|
-
}
|
56
|
-
|
57
|
-
function ascii(object, processed, indent) {
|
58
|
-
if (typeof object == "string") {
|
59
|
-
var quote = typeof this.quoteStrings != "boolean" || this.quoteStrings;
|
60
|
-
return processed || quote ? '"' + object + '"' : object;
|
61
|
-
}
|
62
|
-
|
63
|
-
if (typeof object == "function" && !(object instanceof RegExp)) {
|
64
|
-
return ascii.func(object);
|
65
|
-
}
|
66
|
-
|
67
|
-
processed = processed || [];
|
68
|
-
|
69
|
-
if (isCircular(object, processed)) {
|
70
|
-
return "[Circular]";
|
71
|
-
}
|
72
|
-
|
73
|
-
if (Object.prototype.toString.call(object) == "[object Array]") {
|
74
|
-
return ascii.array.call(this, object);
|
75
|
-
}
|
76
|
-
|
77
|
-
if (!object) {
|
78
|
-
return "" + object;
|
79
|
-
}
|
80
|
-
|
81
|
-
if (buster.isElement(object)) {
|
82
|
-
return ascii.element(object);
|
83
|
-
}
|
84
|
-
|
85
|
-
if (typeof object.toString == "function" &&
|
86
|
-
object.toString !== Object.prototype.toString) {
|
87
|
-
return object.toString();
|
88
|
-
}
|
89
|
-
|
90
|
-
for (var i = 0, l = specialObjects.length; i < l; i++) {
|
91
|
-
if (object === specialObjects[i].obj) {
|
92
|
-
return specialObjects[i].value;
|
93
|
-
}
|
94
|
-
}
|
95
|
-
|
96
|
-
return ascii.object.call(this, object, processed, indent);
|
97
|
-
}
|
98
|
-
|
99
|
-
ascii.func = function (func) {
|
100
|
-
return "function " + buster.functionName(func) + "() {}";
|
101
|
-
};
|
102
|
-
|
103
|
-
ascii.array = function (array, processed) {
|
104
|
-
processed = processed || [];
|
105
|
-
processed.push(array);
|
106
|
-
var pieces = [];
|
107
|
-
|
108
|
-
for (var i = 0, l = array.length; i < l; ++i) {
|
109
|
-
pieces.push(ascii.call(this, array[i], processed));
|
110
|
-
}
|
111
|
-
|
112
|
-
return "[" + pieces.join(", ") + "]";
|
113
|
-
};
|
114
|
-
|
115
|
-
ascii.object = function (object, processed, indent) {
|
116
|
-
processed = processed || [];
|
117
|
-
processed.push(object);
|
118
|
-
indent = indent || 0;
|
119
|
-
var pieces = [], properties = keys(object), prop, str, obj;
|
120
|
-
var is = "";
|
121
|
-
var length = 3;
|
122
|
-
|
123
|
-
for (var i = 0, l = indent; i < l; ++i) {
|
124
|
-
is += " ";
|
125
|
-
}
|
126
|
-
|
127
|
-
for (i = 0, l = properties.length; i < l; ++i) {
|
128
|
-
prop = properties[i];
|
129
|
-
obj = object[prop];
|
130
|
-
|
131
|
-
if (isCircular(obj, processed)) {
|
132
|
-
str = "[Circular]";
|
133
|
-
} else {
|
134
|
-
str = ascii.call(this, obj, processed, indent + 2);
|
135
|
-
}
|
136
|
-
|
137
|
-
str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str;
|
138
|
-
length += str.length;
|
139
|
-
pieces.push(str);
|
140
|
-
}
|
141
|
-
|
142
|
-
var cons = ascii.constructorName.call(this, object);
|
143
|
-
var prefix = cons ? "[" + cons + "] " : ""
|
144
|
-
|
145
|
-
return (length + indent) > 80 ?
|
146
|
-
prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" + is + "}" :
|
147
|
-
prefix + "{ " + pieces.join(", ") + " }";
|
148
|
-
};
|
149
|
-
|
150
|
-
ascii.element = function (element) {
|
151
|
-
var tagName = element.tagName.toLowerCase();
|
152
|
-
var attrs = element.attributes, attribute, pairs = [], attrName;
|
153
|
-
|
154
|
-
for (var i = 0, l = attrs.length; i < l; ++i) {
|
155
|
-
attribute = attrs.item(i);
|
156
|
-
attrName = attribute.nodeName.toLowerCase().replace("html:", "");
|
157
|
-
|
158
|
-
if (attrName == "contenteditable" && attribute.nodeValue == "inherit") {
|
159
|
-
continue;
|
160
|
-
}
|
161
|
-
|
162
|
-
if (!!attribute.nodeValue) {
|
163
|
-
pairs.push(attrName + "=\"" + attribute.nodeValue + "\"");
|
164
|
-
}
|
165
|
-
}
|
166
|
-
|
167
|
-
var formatted = "<" + tagName + (pairs.length > 0 ? " " : "");
|
168
|
-
var content = element.innerHTML;
|
169
|
-
|
170
|
-
if (content.length > 20) {
|
171
|
-
content = content.substr(0, 20) + "[...]";
|
172
|
-
}
|
173
|
-
|
174
|
-
var res = formatted + pairs.join(" ") + ">" + content + "</" + tagName + ">";
|
175
|
-
|
176
|
-
return res.replace(/ contentEditable="inherit"/, "");
|
177
|
-
};
|
178
|
-
|
179
|
-
ascii.constructorName = function (object) {
|
180
|
-
var name = buster.functionName(object && object.constructor);
|
181
|
-
var excludes = this.excludeConstructors || buster.format.excludeConstructors || [];
|
182
|
-
|
183
|
-
for (var i = 0, l = excludes.length; i < l; ++i) {
|
184
|
-
if (typeof excludes[i] == "string" && excludes[i] == name) {
|
185
|
-
return "";
|
186
|
-
} else if (excludes[i].test && excludes[i].test(name)) {
|
187
|
-
return "";
|
188
|
-
}
|
189
|
-
}
|
190
|
-
|
191
|
-
return name;
|
192
|
-
};
|
193
|
-
|
194
|
-
return ascii;
|
195
|
-
}());
|
196
|
-
|
197
|
-
if (typeof module != "undefined") {
|
198
|
-
module.exports = buster.format;
|
199
|
-
}
|