ende 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/component.json +2 -2
  3. data/components/indefinido/indemma/master/component.json +27 -17
  4. data/components/indefinido/indemma/master/lib/record/associable.js +74 -75
  5. data/components/indefinido/indemma/master/lib/record/dirtyable.js +40 -0
  6. data/components/indefinido/indemma/master/lib/record/queryable.js +2 -2
  7. data/components/indefinido/indemma/master/lib/record/resource.js +1 -1
  8. data/components/indefinido/indemma/master/lib/record/rest.js +7 -2
  9. data/components/indefinido/indemma/master/lib/record/restfulable.js +37 -10
  10. data/components/indefinido/indemma/master/lib/record/scopable.js +20 -47
  11. data/components/indefinido/indemma/master/lib/record/storable.js +11 -0
  12. data/components/indefinido/indemma/master/lib/record/validatable.js +195 -1068
  13. data/components/indefinido/indemma/master/lib/record.js +1 -1
  14. data/components/indefinido/indemma/master/vendor/stampit.js +568 -242
  15. data/components/indefinido/observable/es6-modules/component.json +39 -0
  16. data/components/indefinido/{indemma/master/components/indefinido-observable → observable/es6-modules}/lib/adapters/rivets.js +3 -1
  17. data/components/indefinido/observable/es6-modules/lib/legacy/notifierable.js +145 -0
  18. data/components/indefinido/observable/es6-modules/lib/legacy/schedulerable.js +114 -0
  19. data/components/indefinido/observable/es6-modules/lib/lookup.js +38 -0
  20. data/components/indefinido/observable/es6-modules/lib/observable/keypath_observer.js +38 -0
  21. data/components/indefinido/observable/es6-modules/lib/observable/observation.js +45 -0
  22. data/components/indefinido/observable/es6-modules/lib/observable/selection.js +57 -0
  23. data/components/indefinido/observable/es6-modules/lib/observable/self_observer.js +38 -0
  24. data/components/indefinido/observable/es6-modules/lib/observable.js +90 -0
  25. data/components/indefinido/observable/es6-modules/lib/platform.js +12 -0
  26. data/components/indefinido/observable/es6-modules/vendor/observe-js/observe.js +1631 -0
  27. data/components/indefinido/{indemma/master/components/indefinido-observable → observable/es6-modules}/vendor/shims/accessors.js +85 -10
  28. data/lib/assets/javascripts/aura/extensions/rivets.js.coffee +1 -1
  29. data/lib/ende/version.rb +1 -1
  30. data/vendor/assets/components/ende_build.js +18379 -26828
  31. metadata +20 -128
  32. data/components/indefinido/indemma/master/.gitignore +0 -17
  33. data/components/indefinido/indemma/master/.ruby-gemset +0 -1
  34. data/components/indefinido/indemma/master/.ruby-version +0 -1
  35. data/components/indefinido/indemma/master/Gemfile +0 -13
  36. data/components/indefinido/indemma/master/Guardfile +0 -39
  37. data/components/indefinido/indemma/master/History.md +0 -0
  38. data/components/indefinido/indemma/master/Readme.md +0 -447
  39. data/components/indefinido/indemma/master/build/build.js +0 -26288
  40. data/components/indefinido/indemma/master/build/development.js +0 -22200
  41. data/components/indefinido/indemma/master/build/release.js +0 -22139
  42. data/components/indefinido/indemma/master/build/test.js +0 -22200
  43. data/components/indefinido/indemma/master/components/chaijs-assertion-error/component.json +0 -18
  44. data/components/indefinido/indemma/master/components/chaijs-assertion-error/index.js +0 -110
  45. data/components/indefinido/indemma/master/components/chaijs-chai/component.json +0 -47
  46. data/components/indefinido/indemma/master/components/chaijs-chai/index.js +0 -1
  47. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/assertion.js +0 -130
  48. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/core/assertions.js +0 -1270
  49. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/interface/assert.js +0 -1080
  50. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/interface/expect.js +0 -12
  51. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/interface/should.js +0 -76
  52. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +0 -94
  53. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/addMethod.js +0 -37
  54. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/addProperty.js +0 -40
  55. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/eql.js +0 -129
  56. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/flag.js +0 -32
  57. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/getActual.js +0 -19
  58. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +0 -25
  59. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/getMessage.js +0 -49
  60. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/getName.js +0 -20
  61. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/getPathValue.js +0 -102
  62. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/getProperties.js +0 -35
  63. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/index.js +0 -108
  64. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/inspect.js +0 -320
  65. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/objDisplay.js +0 -48
  66. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +0 -51
  67. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +0 -54
  68. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/test.js +0 -26
  69. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/transferFlags.js +0 -44
  70. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai/utils/type.js +0 -45
  71. data/components/indefinido/indemma/master/components/chaijs-chai/lib/chai.js +0 -80
  72. data/components/indefinido/indemma/master/components/component-bind/component.json +0 -14
  73. data/components/indefinido/indemma/master/components/component-bind/index.js +0 -24
  74. data/components/indefinido/indemma/master/components/component-jquery/component.json +0 -14
  75. data/components/indefinido/indemma/master/components/component-jquery/index.js +0 -9601
  76. data/components/indefinido/indemma/master/components/component-type/component.json +0 -18
  77. data/components/indefinido/indemma/master/components/component-type/index.js +0 -32
  78. data/components/indefinido/indemma/master/components/indefinido-advisable/component.json +0 -21
  79. data/components/indefinido/indemma/master/components/indefinido-advisable/index.js +0 -1
  80. data/components/indefinido/indemma/master/components/indefinido-advisable/lib/advisable.js +0 -60
  81. data/components/indefinido/indemma/master/components/indefinido-observable/component.json +0 -25
  82. data/components/indefinido/indemma/master/components/indefinido-observable/components/cjohansen-sinon/sinon.js +0 -4290
  83. data/components/indefinido/indemma/master/components/indefinido-observable/lib/observable.js +0 -323
  84. data/components/indefinido/indemma/master/components/kapit-observe-utils/component.json +0 -13
  85. data/components/indefinido/indemma/master/components/paulmillr-es6-shim/component.json +0 -17
  86. data/components/indefinido/indemma/master/components/paulmillr-es6-shim/es6-shim.js +0 -996
  87. data/components/indefinido/indemma/master/components/pluma-assimilate/component.json +0 -25
  88. data/components/indefinido/indemma/master/components/pluma-assimilate/dist/assimilate.js +0 -127
  89. data/components/indefinido/indemma/master/karma.conf.js +0 -76
  90. data/components/indefinido/indemma/master/package.json +0 -9
  91. data/components/indefinido/indemma/master/spec/record/associable_spec.js +0 -137
  92. data/components/indefinido/indemma/master/spec/record/persistable_spec.js +0 -36
  93. data/components/indefinido/indemma/master/spec/record/queryable_spec.js +0 -33
  94. data/components/indefinido/indemma/master/spec/record/resource_spec.js +0 -93
  95. data/components/indefinido/indemma/master/spec/record/rest_spec.js +0 -32
  96. data/components/indefinido/indemma/master/spec/record/restfulable_spec.js +0 -300
  97. data/components/indefinido/indemma/master/spec/record/scopable_spec.js +0 -212
  98. data/components/indefinido/indemma/master/spec/record/storable_spec.js +0 -53
  99. data/components/indefinido/indemma/master/spec/record/translationable.js +0 -28
  100. data/components/indefinido/indemma/master/spec/record/validatable_spec.js +0 -111
  101. data/components/indefinido/indemma/master/spec/record/validations/associated_spec.js +0 -43
  102. data/components/indefinido/indemma/master/spec/record/validations/confirmation_spec.js +0 -36
  103. data/components/indefinido/indemma/master/spec/record/validations/cpf_spec.js +0 -35
  104. data/components/indefinido/indemma/master/spec/record/validations/presence_spec.js +0 -28
  105. data/components/indefinido/indemma/master/spec/record/validations/remote_spec.js +0 -87
  106. data/components/indefinido/indemma/master/spec/record/validations/type_spec.js +0 -48
  107. data/components/indefinido/indemma/master/spec/record_spec.js +0 -37
  108. data/components/indefinido/indemma/master/spec/spec_helper.js +0 -11
  109. data/components/indefinido/indemma/master/spec/support/value_objects/phone.js +0 -45
  110. data/components/indefinido/indemma/master/src/lib/extensions/rivets.coffee +0 -17
  111. data/components/indefinido/indemma/master/src/lib/record/associable.coffee +0 -380
  112. data/components/indefinido/indemma/master/src/lib/record/errors.coffee +0 -20
  113. data/components/indefinido/indemma/master/src/lib/record/maid.coffee +0 -16
  114. data/components/indefinido/indemma/master/src/lib/record/persistable.coffee +0 -32
  115. data/components/indefinido/indemma/master/src/lib/record/queryable.coffee +0 -30
  116. data/components/indefinido/indemma/master/src/lib/record/resource.coffee +0 -106
  117. data/components/indefinido/indemma/master/src/lib/record/rest.coffee +0 -28
  118. data/components/indefinido/indemma/master/src/lib/record/restfulable.coffee +0 -447
  119. data/components/indefinido/indemma/master/src/lib/record/scopable.coffee +0 -294
  120. data/components/indefinido/indemma/master/src/lib/record/storable.coffee +0 -46
  121. data/components/indefinido/indemma/master/src/lib/record/translationable.coffee +0 -18
  122. data/components/indefinido/indemma/master/src/lib/record/validatable.coffee +0 -207
  123. data/components/indefinido/indemma/master/src/lib/record/validations/associated.coffee +0 -30
  124. data/components/indefinido/indemma/master/src/lib/record/validations/confirmation.coffee +0 -17
  125. data/components/indefinido/indemma/master/src/lib/record/validations/cpf.coffee +0 -57
  126. data/components/indefinido/indemma/master/src/lib/record/validations/presence.coffee +0 -16
  127. data/components/indefinido/indemma/master/src/lib/record/validations/remote.coffee +0 -61
  128. data/components/indefinido/indemma/master/src/lib/record/validations/type.coffee +0 -31
  129. data/components/indefinido/indemma/master/src/lib/record/validations/validatorable.coffee +0 -5
  130. data/components/indefinido/indemma/master/src/lib/record.coffee +0 -138
  131. data/components/indefinido/indemma/master/src/spec/record/associable_spec.coffee +0 -130
  132. data/components/indefinido/indemma/master/src/spec/record/persistable_spec.coffee +0 -30
  133. data/components/indefinido/indemma/master/src/spec/record/queryable_spec.coffee +0 -27
  134. data/components/indefinido/indemma/master/src/spec/record/resource_spec.coffee +0 -69
  135. data/components/indefinido/indemma/master/src/spec/record/rest_spec.coffee +0 -22
  136. data/components/indefinido/indemma/master/src/spec/record/restfulable_spec.coffee +0 -215
  137. data/components/indefinido/indemma/master/src/spec/record/scopable_spec.coffee +0 -191
  138. data/components/indefinido/indemma/master/src/spec/record/storable_spec.coffee +0 -40
  139. data/components/indefinido/indemma/master/src/spec/record/translationable.coffee +0 -19
  140. data/components/indefinido/indemma/master/src/spec/record/validatable_spec.coffee +0 -100
  141. data/components/indefinido/indemma/master/src/spec/record/validations/associated_spec.coffee +0 -35
  142. data/components/indefinido/indemma/master/src/spec/record/validations/confirmation_spec.coffee +0 -25
  143. data/components/indefinido/indemma/master/src/spec/record/validations/cpf_spec.coffee +0 -28
  144. data/components/indefinido/indemma/master/src/spec/record/validations/presence_spec.coffee +0 -24
  145. data/components/indefinido/indemma/master/src/spec/record/validations/remote_spec.coffee +0 -74
  146. data/components/indefinido/indemma/master/src/spec/record/validations/type_spec.coffee +0 -33
  147. data/components/indefinido/indemma/master/src/spec/record_spec.coffee +0 -23
  148. data/components/indefinido/indemma/master/src/spec/spec_helper.coffee +0 -9
  149. data/components/indefinido/indemma/master/src/spec/support/value_objects/phone.coffee +0 -30
  150. data/components/indefinido/indemma/master/vendor/object/mixin.js +0 -196
  151. data/components/indefinido/indemma/master/vendor/sinon.js +0 -4290
  152. /data/components/indefinido/{indemma/master/components/indefinido-observable → observable/es6-modules}/index.js +0 -0
  153. /data/components/indefinido/{indemma/master/components/indefinido-observable → observable/es6-modules}/vendor/shims/accessors-legacy.js +0 -0
  154. /data/components/indefinido/{indemma/master/components/indefinido-observable → observable/es6-modules}/vendor/shims/array.indexOf.js +0 -0
  155. /data/components/indefinido/{indemma/master/components/indefinido-observable → observable/es6-modules}/vendor/shims/object.create.js +0 -0
@@ -1,1080 +0,0 @@
1
- /*!
2
- * chai
3
- * Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
4
- * MIT Licensed
5
- */
6
-
7
-
8
- module.exports = function (chai, util) {
9
-
10
- /*!
11
- * Chai dependencies.
12
- */
13
-
14
- var Assertion = chai.Assertion
15
- , flag = util.flag;
16
-
17
- /*!
18
- * Module export.
19
- */
20
-
21
- /**
22
- * ### assert(expression, message)
23
- *
24
- * Write your own test expressions.
25
- *
26
- * assert('foo' !== 'bar', 'foo is not bar');
27
- * assert(Array.isArray([]), 'empty arrays are arrays');
28
- *
29
- * @param {Mixed} expression to test for truthiness
30
- * @param {String} message to display on error
31
- * @name assert
32
- * @api public
33
- */
34
-
35
- var assert = chai.assert = function (express, errmsg) {
36
- var test = new Assertion(null);
37
- test.assert(
38
- express
39
- , errmsg
40
- , '[ negation message unavailable ]'
41
- );
42
- };
43
-
44
- /**
45
- * ### .fail(actual, expected, [message], [operator])
46
- *
47
- * Throw a failure. Node.js `assert` module-compatible.
48
- *
49
- * @name fail
50
- * @param {Mixed} actual
51
- * @param {Mixed} expected
52
- * @param {String} message
53
- * @param {String} operator
54
- * @api public
55
- */
56
-
57
- assert.fail = function (actual, expected, message, operator) {
58
- throw new chai.AssertionError({
59
- actual: actual
60
- , expected: expected
61
- , message: message
62
- , operator: operator
63
- , stackStartFunction: assert.fail
64
- });
65
- };
66
-
67
- /**
68
- * ### .ok(object, [message])
69
- *
70
- * Asserts that `object` is truthy.
71
- *
72
- * assert.ok('everything', 'everything is ok');
73
- * assert.ok(false, 'this will fail');
74
- *
75
- * @name ok
76
- * @param {Mixed} object to test
77
- * @param {String} message
78
- * @api public
79
- */
80
-
81
- assert.ok = function (val, msg) {
82
- new Assertion(val, msg).is.ok;
83
- };
84
-
85
- /**
86
- * ### .notOk(object, [message])
87
- *
88
- * Asserts that `object` is falsy.
89
- *
90
- * assert.notOk('everything', 'this will fail');
91
- * assert.notOk(false, 'this will pass');
92
- *
93
- * @name notOk
94
- * @param {Mixed} object to test
95
- * @param {String} message
96
- * @api public
97
- */
98
-
99
- assert.notOk = function (val, msg) {
100
- new Assertion(val, msg).is.not.ok;
101
- };
102
-
103
- /**
104
- * ### .equal(actual, expected, [message])
105
- *
106
- * Asserts non-strict equality (`==`) of `actual` and `expected`.
107
- *
108
- * assert.equal(3, '3', '== coerces values to strings');
109
- *
110
- * @name equal
111
- * @param {Mixed} actual
112
- * @param {Mixed} expected
113
- * @param {String} message
114
- * @api public
115
- */
116
-
117
- assert.equal = function (act, exp, msg) {
118
- var test = new Assertion(act, msg);
119
-
120
- test.assert(
121
- exp == flag(test, 'object')
122
- , 'expected #{this} to equal #{exp}'
123
- , 'expected #{this} to not equal #{act}'
124
- , exp
125
- , act
126
- );
127
- };
128
-
129
- /**
130
- * ### .notEqual(actual, expected, [message])
131
- *
132
- * Asserts non-strict inequality (`!=`) of `actual` and `expected`.
133
- *
134
- * assert.notEqual(3, 4, 'these numbers are not equal');
135
- *
136
- * @name notEqual
137
- * @param {Mixed} actual
138
- * @param {Mixed} expected
139
- * @param {String} message
140
- * @api public
141
- */
142
-
143
- assert.notEqual = function (act, exp, msg) {
144
- var test = new Assertion(act, msg);
145
-
146
- test.assert(
147
- exp != flag(test, 'object')
148
- , 'expected #{this} to not equal #{exp}'
149
- , 'expected #{this} to equal #{act}'
150
- , exp
151
- , act
152
- );
153
- };
154
-
155
- /**
156
- * ### .strictEqual(actual, expected, [message])
157
- *
158
- * Asserts strict equality (`===`) of `actual` and `expected`.
159
- *
160
- * assert.strictEqual(true, true, 'these booleans are strictly equal');
161
- *
162
- * @name strictEqual
163
- * @param {Mixed} actual
164
- * @param {Mixed} expected
165
- * @param {String} message
166
- * @api public
167
- */
168
-
169
- assert.strictEqual = function (act, exp, msg) {
170
- new Assertion(act, msg).to.equal(exp);
171
- };
172
-
173
- /**
174
- * ### .notStrictEqual(actual, expected, [message])
175
- *
176
- * Asserts strict inequality (`!==`) of `actual` and `expected`.
177
- *
178
- * assert.notStrictEqual(3, '3', 'no coercion for strict equality');
179
- *
180
- * @name notStrictEqual
181
- * @param {Mixed} actual
182
- * @param {Mixed} expected
183
- * @param {String} message
184
- * @api public
185
- */
186
-
187
- assert.notStrictEqual = function (act, exp, msg) {
188
- new Assertion(act, msg).to.not.equal(exp);
189
- };
190
-
191
- /**
192
- * ### .deepEqual(actual, expected, [message])
193
- *
194
- * Asserts that `actual` is deeply equal to `expected`.
195
- *
196
- * assert.deepEqual({ tea: 'green' }, { tea: 'green' });
197
- *
198
- * @name deepEqual
199
- * @param {Mixed} actual
200
- * @param {Mixed} expected
201
- * @param {String} message
202
- * @api public
203
- */
204
-
205
- assert.deepEqual = function (act, exp, msg) {
206
- new Assertion(act, msg).to.eql(exp);
207
- };
208
-
209
- /**
210
- * ### .notDeepEqual(actual, expected, [message])
211
- *
212
- * Assert that `actual` is not deeply equal to `expected`.
213
- *
214
- * assert.notDeepEqual({ tea: 'green' }, { tea: 'jasmine' });
215
- *
216
- * @name notDeepEqual
217
- * @param {Mixed} actual
218
- * @param {Mixed} expected
219
- * @param {String} message
220
- * @api public
221
- */
222
-
223
- assert.notDeepEqual = function (act, exp, msg) {
224
- new Assertion(act, msg).to.not.eql(exp);
225
- };
226
-
227
- /**
228
- * ### .isTrue(value, [message])
229
- *
230
- * Asserts that `value` is true.
231
- *
232
- * var teaServed = true;
233
- * assert.isTrue(teaServed, 'the tea has been served');
234
- *
235
- * @name isTrue
236
- * @param {Mixed} value
237
- * @param {String} message
238
- * @api public
239
- */
240
-
241
- assert.isTrue = function (val, msg) {
242
- new Assertion(val, msg).is['true'];
243
- };
244
-
245
- /**
246
- * ### .isFalse(value, [message])
247
- *
248
- * Asserts that `value` is false.
249
- *
250
- * var teaServed = false;
251
- * assert.isFalse(teaServed, 'no tea yet? hmm...');
252
- *
253
- * @name isFalse
254
- * @param {Mixed} value
255
- * @param {String} message
256
- * @api public
257
- */
258
-
259
- assert.isFalse = function (val, msg) {
260
- new Assertion(val, msg).is['false'];
261
- };
262
-
263
- /**
264
- * ### .isNull(value, [message])
265
- *
266
- * Asserts that `value` is null.
267
- *
268
- * assert.isNull(err, 'there was no error');
269
- *
270
- * @name isNull
271
- * @param {Mixed} value
272
- * @param {String} message
273
- * @api public
274
- */
275
-
276
- assert.isNull = function (val, msg) {
277
- new Assertion(val, msg).to.equal(null);
278
- };
279
-
280
- /**
281
- * ### .isNotNull(value, [message])
282
- *
283
- * Asserts that `value` is not null.
284
- *
285
- * var tea = 'tasty chai';
286
- * assert.isNotNull(tea, 'great, time for tea!');
287
- *
288
- * @name isNotNull
289
- * @param {Mixed} value
290
- * @param {String} message
291
- * @api public
292
- */
293
-
294
- assert.isNotNull = function (val, msg) {
295
- new Assertion(val, msg).to.not.equal(null);
296
- };
297
-
298
- /**
299
- * ### .isUndefined(value, [message])
300
- *
301
- * Asserts that `value` is `undefined`.
302
- *
303
- * var tea;
304
- * assert.isUndefined(tea, 'no tea defined');
305
- *
306
- * @name isUndefined
307
- * @param {Mixed} value
308
- * @param {String} message
309
- * @api public
310
- */
311
-
312
- assert.isUndefined = function (val, msg) {
313
- new Assertion(val, msg).to.equal(undefined);
314
- };
315
-
316
- /**
317
- * ### .isDefined(value, [message])
318
- *
319
- * Asserts that `value` is not `undefined`.
320
- *
321
- * var tea = 'cup of chai';
322
- * assert.isDefined(tea, 'tea has been defined');
323
- *
324
- * @name isDefined
325
- * @param {Mixed} value
326
- * @param {String} message
327
- * @api public
328
- */
329
-
330
- assert.isDefined = function (val, msg) {
331
- new Assertion(val, msg).to.not.equal(undefined);
332
- };
333
-
334
- /**
335
- * ### .isFunction(value, [message])
336
- *
337
- * Asserts that `value` is a function.
338
- *
339
- * function serveTea() { return 'cup of tea'; };
340
- * assert.isFunction(serveTea, 'great, we can have tea now');
341
- *
342
- * @name isFunction
343
- * @param {Mixed} value
344
- * @param {String} message
345
- * @api public
346
- */
347
-
348
- assert.isFunction = function (val, msg) {
349
- new Assertion(val, msg).to.be.a('function');
350
- };
351
-
352
- /**
353
- * ### .isNotFunction(value, [message])
354
- *
355
- * Asserts that `value` is _not_ a function.
356
- *
357
- * var serveTea = [ 'heat', 'pour', 'sip' ];
358
- * assert.isNotFunction(serveTea, 'great, we have listed the steps');
359
- *
360
- * @name isNotFunction
361
- * @param {Mixed} value
362
- * @param {String} message
363
- * @api public
364
- */
365
-
366
- assert.isNotFunction = function (val, msg) {
367
- new Assertion(val, msg).to.not.be.a('function');
368
- };
369
-
370
- /**
371
- * ### .isObject(value, [message])
372
- *
373
- * Asserts that `value` is an object (as revealed by
374
- * `Object.prototype.toString`).
375
- *
376
- * var selection = { name: 'Chai', serve: 'with spices' };
377
- * assert.isObject(selection, 'tea selection is an object');
378
- *
379
- * @name isObject
380
- * @param {Mixed} value
381
- * @param {String} message
382
- * @api public
383
- */
384
-
385
- assert.isObject = function (val, msg) {
386
- new Assertion(val, msg).to.be.a('object');
387
- };
388
-
389
- /**
390
- * ### .isNotObject(value, [message])
391
- *
392
- * Asserts that `value` is _not_ an object.
393
- *
394
- * var selection = 'chai'
395
- * assert.isObject(selection, 'tea selection is not an object');
396
- * assert.isObject(null, 'null is not an object');
397
- *
398
- * @name isNotObject
399
- * @param {Mixed} value
400
- * @param {String} message
401
- * @api public
402
- */
403
-
404
- assert.isNotObject = function (val, msg) {
405
- new Assertion(val, msg).to.not.be.a('object');
406
- };
407
-
408
- /**
409
- * ### .isArray(value, [message])
410
- *
411
- * Asserts that `value` is an array.
412
- *
413
- * var menu = [ 'green', 'chai', 'oolong' ];
414
- * assert.isArray(menu, 'what kind of tea do we want?');
415
- *
416
- * @name isArray
417
- * @param {Mixed} value
418
- * @param {String} message
419
- * @api public
420
- */
421
-
422
- assert.isArray = function (val, msg) {
423
- new Assertion(val, msg).to.be.an('array');
424
- };
425
-
426
- /**
427
- * ### .isNotArray(value, [message])
428
- *
429
- * Asserts that `value` is _not_ an array.
430
- *
431
- * var menu = 'green|chai|oolong';
432
- * assert.isNotArray(menu, 'what kind of tea do we want?');
433
- *
434
- * @name isNotArray
435
- * @param {Mixed} value
436
- * @param {String} message
437
- * @api public
438
- */
439
-
440
- assert.isNotArray = function (val, msg) {
441
- new Assertion(val, msg).to.not.be.an('array');
442
- };
443
-
444
- /**
445
- * ### .isString(value, [message])
446
- *
447
- * Asserts that `value` is a string.
448
- *
449
- * var teaOrder = 'chai';
450
- * assert.isString(teaOrder, 'order placed');
451
- *
452
- * @name isString
453
- * @param {Mixed} value
454
- * @param {String} message
455
- * @api public
456
- */
457
-
458
- assert.isString = function (val, msg) {
459
- new Assertion(val, msg).to.be.a('string');
460
- };
461
-
462
- /**
463
- * ### .isNotString(value, [message])
464
- *
465
- * Asserts that `value` is _not_ a string.
466
- *
467
- * var teaOrder = 4;
468
- * assert.isNotString(teaOrder, 'order placed');
469
- *
470
- * @name isNotString
471
- * @param {Mixed} value
472
- * @param {String} message
473
- * @api public
474
- */
475
-
476
- assert.isNotString = function (val, msg) {
477
- new Assertion(val, msg).to.not.be.a('string');
478
- };
479
-
480
- /**
481
- * ### .isNumber(value, [message])
482
- *
483
- * Asserts that `value` is a number.
484
- *
485
- * var cups = 2;
486
- * assert.isNumber(cups, 'how many cups');
487
- *
488
- * @name isNumber
489
- * @param {Number} value
490
- * @param {String} message
491
- * @api public
492
- */
493
-
494
- assert.isNumber = function (val, msg) {
495
- new Assertion(val, msg).to.be.a('number');
496
- };
497
-
498
- /**
499
- * ### .isNotNumber(value, [message])
500
- *
501
- * Asserts that `value` is _not_ a number.
502
- *
503
- * var cups = '2 cups please';
504
- * assert.isNotNumber(cups, 'how many cups');
505
- *
506
- * @name isNotNumber
507
- * @param {Mixed} value
508
- * @param {String} message
509
- * @api public
510
- */
511
-
512
- assert.isNotNumber = function (val, msg) {
513
- new Assertion(val, msg).to.not.be.a('number');
514
- };
515
-
516
- /**
517
- * ### .isBoolean(value, [message])
518
- *
519
- * Asserts that `value` is a boolean.
520
- *
521
- * var teaReady = true
522
- * , teaServed = false;
523
- *
524
- * assert.isBoolean(teaReady, 'is the tea ready');
525
- * assert.isBoolean(teaServed, 'has tea been served');
526
- *
527
- * @name isBoolean
528
- * @param {Mixed} value
529
- * @param {String} message
530
- * @api public
531
- */
532
-
533
- assert.isBoolean = function (val, msg) {
534
- new Assertion(val, msg).to.be.a('boolean');
535
- };
536
-
537
- /**
538
- * ### .isNotBoolean(value, [message])
539
- *
540
- * Asserts that `value` is _not_ a boolean.
541
- *
542
- * var teaReady = 'yep'
543
- * , teaServed = 'nope';
544
- *
545
- * assert.isNotBoolean(teaReady, 'is the tea ready');
546
- * assert.isNotBoolean(teaServed, 'has tea been served');
547
- *
548
- * @name isNotBoolean
549
- * @param {Mixed} value
550
- * @param {String} message
551
- * @api public
552
- */
553
-
554
- assert.isNotBoolean = function (val, msg) {
555
- new Assertion(val, msg).to.not.be.a('boolean');
556
- };
557
-
558
- /**
559
- * ### .typeOf(value, name, [message])
560
- *
561
- * Asserts that `value`'s type is `name`, as determined by
562
- * `Object.prototype.toString`.
563
- *
564
- * assert.typeOf({ tea: 'chai' }, 'object', 'we have an object');
565
- * assert.typeOf(['chai', 'jasmine'], 'array', 'we have an array');
566
- * assert.typeOf('tea', 'string', 'we have a string');
567
- * assert.typeOf(/tea/, 'regexp', 'we have a regular expression');
568
- * assert.typeOf(null, 'null', 'we have a null');
569
- * assert.typeOf(undefined, 'undefined', 'we have an undefined');
570
- *
571
- * @name typeOf
572
- * @param {Mixed} value
573
- * @param {String} name
574
- * @param {String} message
575
- * @api public
576
- */
577
-
578
- assert.typeOf = function (val, type, msg) {
579
- new Assertion(val, msg).to.be.a(type);
580
- };
581
-
582
- /**
583
- * ### .notTypeOf(value, name, [message])
584
- *
585
- * Asserts that `value`'s type is _not_ `name`, as determined by
586
- * `Object.prototype.toString`.
587
- *
588
- * assert.notTypeOf('tea', 'number', 'strings are not numbers');
589
- *
590
- * @name notTypeOf
591
- * @param {Mixed} value
592
- * @param {String} typeof name
593
- * @param {String} message
594
- * @api public
595
- */
596
-
597
- assert.notTypeOf = function (val, type, msg) {
598
- new Assertion(val, msg).to.not.be.a(type);
599
- };
600
-
601
- /**
602
- * ### .instanceOf(object, constructor, [message])
603
- *
604
- * Asserts that `value` is an instance of `constructor`.
605
- *
606
- * var Tea = function (name) { this.name = name; }
607
- * , chai = new Tea('chai');
608
- *
609
- * assert.instanceOf(chai, Tea, 'chai is an instance of tea');
610
- *
611
- * @name instanceOf
612
- * @param {Object} object
613
- * @param {Constructor} constructor
614
- * @param {String} message
615
- * @api public
616
- */
617
-
618
- assert.instanceOf = function (val, type, msg) {
619
- new Assertion(val, msg).to.be.instanceOf(type);
620
- };
621
-
622
- /**
623
- * ### .notInstanceOf(object, constructor, [message])
624
- *
625
- * Asserts `value` is not an instance of `constructor`.
626
- *
627
- * var Tea = function (name) { this.name = name; }
628
- * , chai = new String('chai');
629
- *
630
- * assert.notInstanceOf(chai, Tea, 'chai is not an instance of tea');
631
- *
632
- * @name notInstanceOf
633
- * @param {Object} object
634
- * @param {Constructor} constructor
635
- * @param {String} message
636
- * @api public
637
- */
638
-
639
- assert.notInstanceOf = function (val, type, msg) {
640
- new Assertion(val, msg).to.not.be.instanceOf(type);
641
- };
642
-
643
- /**
644
- * ### .include(haystack, needle, [message])
645
- *
646
- * Asserts that `haystack` includes `needle`. Works
647
- * for strings and arrays.
648
- *
649
- * assert.include('foobar', 'bar', 'foobar contains string "bar"');
650
- * assert.include([ 1, 2, 3 ], 3, 'array contains value');
651
- *
652
- * @name include
653
- * @param {Array|String} haystack
654
- * @param {Mixed} needle
655
- * @param {String} message
656
- * @api public
657
- */
658
-
659
- assert.include = function (exp, inc, msg) {
660
- var obj = new Assertion(exp, msg);
661
-
662
- if (Array.isArray(exp)) {
663
- obj.to.include(inc);
664
- } else if ('string' === typeof exp) {
665
- obj.to.contain.string(inc);
666
- } else {
667
- throw new chai.AssertionError(
668
- 'expected an array or string'
669
- , null
670
- , assert.include
671
- );
672
- }
673
- };
674
-
675
- /**
676
- * ### .notInclude(haystack, needle, [message])
677
- *
678
- * Asserts that `haystack` does not include `needle`. Works
679
- * for strings and arrays.
680
- *i
681
- * assert.notInclude('foobar', 'baz', 'string not include substring');
682
- * assert.notInclude([ 1, 2, 3 ], 4, 'array not include contain value');
683
- *
684
- * @name notInclude
685
- * @param {Array|String} haystack
686
- * @param {Mixed} needle
687
- * @param {String} message
688
- * @api public
689
- */
690
-
691
- assert.notInclude = function (exp, inc, msg) {
692
- var obj = new Assertion(exp, msg);
693
-
694
- if (Array.isArray(exp)) {
695
- obj.to.not.include(inc);
696
- } else if ('string' === typeof exp) {
697
- obj.to.not.contain.string(inc);
698
- } else {
699
- throw new chai.AssertionError(
700
- 'expected an array or string'
701
- , null
702
- , assert.notInclude
703
- );
704
- }
705
- };
706
-
707
- /**
708
- * ### .match(value, regexp, [message])
709
- *
710
- * Asserts that `value` matches the regular expression `regexp`.
711
- *
712
- * assert.match('foobar', /^foo/, 'regexp matches');
713
- *
714
- * @name match
715
- * @param {Mixed} value
716
- * @param {RegExp} regexp
717
- * @param {String} message
718
- * @api public
719
- */
720
-
721
- assert.match = function (exp, re, msg) {
722
- new Assertion(exp, msg).to.match(re);
723
- };
724
-
725
- /**
726
- * ### .notMatch(value, regexp, [message])
727
- *
728
- * Asserts that `value` does not match the regular expression `regexp`.
729
- *
730
- * assert.notMatch('foobar', /^foo/, 'regexp does not match');
731
- *
732
- * @name notMatch
733
- * @param {Mixed} value
734
- * @param {RegExp} regexp
735
- * @param {String} message
736
- * @api public
737
- */
738
-
739
- assert.notMatch = function (exp, re, msg) {
740
- new Assertion(exp, msg).to.not.match(re);
741
- };
742
-
743
- /**
744
- * ### .property(object, property, [message])
745
- *
746
- * Asserts that `object` has a property named by `property`.
747
- *
748
- * assert.property({ tea: { green: 'matcha' }}, 'tea');
749
- *
750
- * @name property
751
- * @param {Object} object
752
- * @param {String} property
753
- * @param {String} message
754
- * @api public
755
- */
756
-
757
- assert.property = function (obj, prop, msg) {
758
- new Assertion(obj, msg).to.have.property(prop);
759
- };
760
-
761
- /**
762
- * ### .notProperty(object, property, [message])
763
- *
764
- * Asserts that `object` does _not_ have a property named by `property`.
765
- *
766
- * assert.notProperty({ tea: { green: 'matcha' }}, 'coffee');
767
- *
768
- * @name notProperty
769
- * @param {Object} object
770
- * @param {String} property
771
- * @param {String} message
772
- * @api public
773
- */
774
-
775
- assert.notProperty = function (obj, prop, msg) {
776
- new Assertion(obj, msg).to.not.have.property(prop);
777
- };
778
-
779
- /**
780
- * ### .deepProperty(object, property, [message])
781
- *
782
- * Asserts that `object` has a property named by `property`, which can be a
783
- * string using dot- and bracket-notation for deep reference.
784
- *
785
- * assert.deepProperty({ tea: { green: 'matcha' }}, 'tea.green');
786
- *
787
- * @name deepProperty
788
- * @param {Object} object
789
- * @param {String} property
790
- * @param {String} message
791
- * @api public
792
- */
793
-
794
- assert.deepProperty = function (obj, prop, msg) {
795
- new Assertion(obj, msg).to.have.deep.property(prop);
796
- };
797
-
798
- /**
799
- * ### .notDeepProperty(object, property, [message])
800
- *
801
- * Asserts that `object` does _not_ have a property named by `property`, which
802
- * can be a string using dot- and bracket-notation for deep reference.
803
- *
804
- * assert.notDeepProperty({ tea: { green: 'matcha' }}, 'tea.oolong');
805
- *
806
- * @name notDeepProperty
807
- * @param {Object} object
808
- * @param {String} property
809
- * @param {String} message
810
- * @api public
811
- */
812
-
813
- assert.notDeepProperty = function (obj, prop, msg) {
814
- new Assertion(obj, msg).to.not.have.deep.property(prop);
815
- };
816
-
817
- /**
818
- * ### .propertyVal(object, property, value, [message])
819
- *
820
- * Asserts that `object` has a property named by `property` with value given
821
- * by `value`.
822
- *
823
- * assert.propertyVal({ tea: 'is good' }, 'tea', 'is good');
824
- *
825
- * @name propertyVal
826
- * @param {Object} object
827
- * @param {String} property
828
- * @param {Mixed} value
829
- * @param {String} message
830
- * @api public
831
- */
832
-
833
- assert.propertyVal = function (obj, prop, val, msg) {
834
- new Assertion(obj, msg).to.have.property(prop, val);
835
- };
836
-
837
- /**
838
- * ### .propertyNotVal(object, property, value, [message])
839
- *
840
- * Asserts that `object` has a property named by `property`, but with a value
841
- * different from that given by `value`.
842
- *
843
- * assert.propertyNotVal({ tea: 'is good' }, 'tea', 'is bad');
844
- *
845
- * @name propertyNotVal
846
- * @param {Object} object
847
- * @param {String} property
848
- * @param {Mixed} value
849
- * @param {String} message
850
- * @api public
851
- */
852
-
853
- assert.propertyNotVal = function (obj, prop, val, msg) {
854
- new Assertion(obj, msg).to.not.have.property(prop, val);
855
- };
856
-
857
- /**
858
- * ### .deepPropertyVal(object, property, value, [message])
859
- *
860
- * Asserts that `object` has a property named by `property` with value given
861
- * by `value`. `property` can use dot- and bracket-notation for deep
862
- * reference.
863
- *
864
- * assert.deepPropertyVal({ tea: { green: 'matcha' }}, 'tea.green', 'matcha');
865
- *
866
- * @name deepPropertyVal
867
- * @param {Object} object
868
- * @param {String} property
869
- * @param {Mixed} value
870
- * @param {String} message
871
- * @api public
872
- */
873
-
874
- assert.deepPropertyVal = function (obj, prop, val, msg) {
875
- new Assertion(obj, msg).to.have.deep.property(prop, val);
876
- };
877
-
878
- /**
879
- * ### .deepPropertyNotVal(object, property, value, [message])
880
- *
881
- * Asserts that `object` has a property named by `property`, but with a value
882
- * different from that given by `value`. `property` can use dot- and
883
- * bracket-notation for deep reference.
884
- *
885
- * assert.deepPropertyNotVal({ tea: { green: 'matcha' }}, 'tea.green', 'konacha');
886
- *
887
- * @name deepPropertyNotVal
888
- * @param {Object} object
889
- * @param {String} property
890
- * @param {Mixed} value
891
- * @param {String} message
892
- * @api public
893
- */
894
-
895
- assert.deepPropertyNotVal = function (obj, prop, val, msg) {
896
- new Assertion(obj, msg).to.not.have.deep.property(prop, val);
897
- };
898
-
899
- /**
900
- * ### .lengthOf(object, length, [message])
901
- *
902
- * Asserts that `object` has a `length` property with the expected value.
903
- *
904
- * assert.lengthOf([1,2,3], 3, 'array has length of 3');
905
- * assert.lengthOf('foobar', 5, 'string has length of 6');
906
- *
907
- * @name lengthOf
908
- * @param {Mixed} object
909
- * @param {Number} length
910
- * @param {String} message
911
- * @api public
912
- */
913
-
914
- assert.lengthOf = function (exp, len, msg) {
915
- new Assertion(exp, msg).to.have.length(len);
916
- };
917
-
918
- /**
919
- * ### .throws(function, [constructor/string/regexp], [string/regexp], [message])
920
- *
921
- * Asserts that `function` will throw an error that is an instance of
922
- * `constructor`, or alternately that it will throw an error with message
923
- * matching `regexp`.
924
- *
925
- * assert.throw(fn, 'function throws a reference error');
926
- * assert.throw(fn, /function throws a reference error/);
927
- * assert.throw(fn, ReferenceError);
928
- * assert.throw(fn, ReferenceError, 'function throws a reference error');
929
- * assert.throw(fn, ReferenceError, /function throws a reference error/);
930
- *
931
- * @name throws
932
- * @alias throw
933
- * @alias Throw
934
- * @param {Function} function
935
- * @param {ErrorConstructor} constructor
936
- * @param {RegExp} regexp
937
- * @param {String} message
938
- * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
939
- * @api public
940
- */
941
-
942
- assert.Throw = function (fn, errt, errs, msg) {
943
- if ('string' === typeof errt || errt instanceof RegExp) {
944
- errs = errt;
945
- errt = null;
946
- }
947
-
948
- new Assertion(fn, msg).to.Throw(errt, errs);
949
- };
950
-
951
- /**
952
- * ### .doesNotThrow(function, [constructor/regexp], [message])
953
- *
954
- * Asserts that `function` will _not_ throw an error that is an instance of
955
- * `constructor`, or alternately that it will not throw an error with message
956
- * matching `regexp`.
957
- *
958
- * assert.doesNotThrow(fn, Error, 'function does not throw');
959
- *
960
- * @name doesNotThrow
961
- * @param {Function} function
962
- * @param {ErrorConstructor} constructor
963
- * @param {RegExp} regexp
964
- * @param {String} message
965
- * @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
966
- * @api public
967
- */
968
-
969
- assert.doesNotThrow = function (fn, type, msg) {
970
- if ('string' === typeof type) {
971
- msg = type;
972
- type = null;
973
- }
974
-
975
- new Assertion(fn, msg).to.not.Throw(type);
976
- };
977
-
978
- /**
979
- * ### .operator(val1, operator, val2, [message])
980
- *
981
- * Compares two values using `operator`.
982
- *
983
- * assert.operator(1, '<', 2, 'everything is ok');
984
- * assert.operator(1, '>', 2, 'this will fail');
985
- *
986
- * @name operator
987
- * @param {Mixed} val1
988
- * @param {String} operator
989
- * @param {Mixed} val2
990
- * @param {String} message
991
- * @api public
992
- */
993
-
994
- assert.operator = function (val, operator, val2, msg) {
995
- if (!~['==', '===', '>', '>=', '<', '<=', '!=', '!=='].indexOf(operator)) {
996
- throw new Error('Invalid operator "' + operator + '"');
997
- }
998
- var test = new Assertion(eval(val + operator + val2), msg);
999
- test.assert(
1000
- true === flag(test, 'object')
1001
- , 'expected ' + util.inspect(val) + ' to be ' + operator + ' ' + util.inspect(val2)
1002
- , 'expected ' + util.inspect(val) + ' to not be ' + operator + ' ' + util.inspect(val2) );
1003
- };
1004
-
1005
- /**
1006
- * ### .closeTo(actual, expected, delta, [message])
1007
- *
1008
- * Asserts that the target is equal `expected`, to within a +/- `delta` range.
1009
- *
1010
- * assert.closeTo(1.5, 1, 0.5, 'numbers are close');
1011
- *
1012
- * @name closeTo
1013
- * @param {Number} actual
1014
- * @param {Number} expected
1015
- * @param {Number} delta
1016
- * @param {String} message
1017
- * @api public
1018
- */
1019
-
1020
- assert.closeTo = function (act, exp, delta, msg) {
1021
- new Assertion(act, msg).to.be.closeTo(exp, delta);
1022
- };
1023
-
1024
- /**
1025
- * ### .sameMembers(set1, set2, [message])
1026
- *
1027
- * Asserts that `set1` and `set2` have the same members.
1028
- * Order is not taken into account.
1029
- *
1030
- * assert.sameMembers([ 1, 2, 3 ], [ 2, 1, 3 ], 'same members');
1031
- *
1032
- * @name sameMembers
1033
- * @param {Array} superset
1034
- * @param {Array} subset
1035
- * @param {String} message
1036
- * @api public
1037
- */
1038
-
1039
- assert.sameMembers = function (set1, set2, msg) {
1040
- new Assertion(set1, msg).to.have.same.members(set2);
1041
- }
1042
-
1043
- /**
1044
- * ### .includeMembers(superset, subset, [message])
1045
- *
1046
- * Asserts that `subset` is included in `superset`.
1047
- * Order is not taken into account.
1048
- *
1049
- * assert.includeMembers([ 1, 2, 3 ], [ 2, 1 ], 'include members');
1050
- *
1051
- * @name includeMembers
1052
- * @param {Array} superset
1053
- * @param {Array} subset
1054
- * @param {String} message
1055
- * @api public
1056
- */
1057
-
1058
- assert.includeMembers = function (superset, subset, msg) {
1059
- new Assertion(superset, msg).to.include.members(subset);
1060
- }
1061
-
1062
- /*!
1063
- * Undocumented / untested
1064
- */
1065
-
1066
- assert.ifError = function (val, msg) {
1067
- new Assertion(val, msg).to.not.be.ok;
1068
- };
1069
-
1070
- /*!
1071
- * Aliases.
1072
- */
1073
-
1074
- (function alias(name, as){
1075
- assert[as] = assert[name];
1076
- return alias;
1077
- })
1078
- ('Throw', 'throw')
1079
- ('Throw', 'throws');
1080
- };