ende 0.1.14 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/component.json +1 -1
- data/lib/assets/javascripts/aura/extensions/devise.js.coffee +5 -2
- data/lib/assets/javascripts/aura/extensions/models.js.coffee.erb +4 -3
- data/lib/assets/javascripts/value_objects/phone.js.coffee +8 -2
- data/lib/assets/javascripts/widgets/viewer/main.js.coffee +18 -21
- data/lib/ende/version.rb +1 -1
- data/lib/ende.rb +2 -2
- data/vendor/assets/javascripts/ende/build.js +485 -4879
- data/vendor/components/component-querystring/component.json +18 -0
- data/vendor/components/component-querystring/index.js +49 -0
- data/vendor/components/component-trim/component.json +13 -0
- data/vendor/components/component-trim/index.js +17 -0
- data/vendor/components/indefinido-indemma/.gitignore +14 -0
- data/vendor/components/indefinido-indemma/.ruby-gemset +1 -0
- data/vendor/components/indefinido-indemma/.ruby-version +1 -0
- data/vendor/components/indefinido-indemma/Gemfile +13 -0
- data/vendor/components/indefinido-indemma/Guardfile +39 -0
- data/vendor/components/indefinido-indemma/History.md +0 -0
- data/vendor/components/indefinido-indemma/Readme.md +443 -0
- data/vendor/components/indefinido-indemma/build/development.js +331 -0
- data/vendor/components/indefinido-indemma/build/release.js +21693 -0
- data/vendor/components/indefinido-indemma/build/test.js +331 -0
- data/vendor/components/indefinido-indemma/component.json +8 -9
- data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/component.json +18 -0
- data/vendor/components/indefinido-indemma/components/chaijs-assertion-error/index.js +110 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/component.json +47 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/index.js +1 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/assertion.js +130 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/core/assertions.js +1270 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/assert.js +1080 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/expect.js +12 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/interface/should.js +76 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addChainableMethod.js +94 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addMethod.js +37 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/addProperty.js +40 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/eql.js +129 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/flag.js +32 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getActual.js +19 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getEnumerableProperties.js +25 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getMessage.js +49 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getName.js +20 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getPathValue.js +102 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/getProperties.js +35 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/index.js +108 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/inspect.js +320 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/objDisplay.js +48 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteMethod.js +51 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/overwriteProperty.js +54 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/test.js +26 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/transferFlags.js +44 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai/utils/type.js +45 -0
- data/vendor/components/indefinido-indemma/components/chaijs-chai/lib/chai.js +80 -0
- data/vendor/components/indefinido-indemma/components/component-bind/component.json +14 -0
- data/vendor/components/indefinido-indemma/components/component-bind/index.js +24 -0
- data/vendor/components/indefinido-indemma/components/component-jquery/component.json +14 -0
- data/vendor/components/indefinido-indemma/components/component-jquery/index.js +9601 -0
- data/vendor/components/indefinido-indemma/components/component-type/component.json +18 -0
- data/vendor/components/indefinido-indemma/components/component-type/index.js +32 -0
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/component.json +21 -0
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/index.js +1 -0
- data/vendor/components/indefinido-indemma/components/indefinido-advisable/lib/advisable.js +60 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/component.json +25 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/components/cjohansen-sinon/sinon.js +4290 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/index.js +1 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/adapters/rivets.js +26 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/lib/observable.js +323 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors-legacy.js +92 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/accessors.js +173 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/array.indexOf.js +8 -0
- data/vendor/components/indefinido-indemma/components/indefinido-observable/vendor/shims/object.create.js +77 -0
- data/vendor/components/indefinido-indemma/components/kapit-observe-utils/component.json +13 -0
- data/vendor/components/indefinido-indemma/components/pluma-assimilate/component.json +25 -0
- data/vendor/components/indefinido-indemma/components/pluma-assimilate/dist/assimilate.js +87 -0
- data/vendor/components/indefinido-indemma/karma.conf.js +86 -0
- data/vendor/components/indefinido-indemma/lib/record/associable.js +6 -6
- data/vendor/components/indefinido-indemma/lib/record/errors.js +1 -0
- data/vendor/components/indefinido-indemma/lib/record/resource.js +14 -3
- data/vendor/components/indefinido-indemma/lib/record/rest.js +7 -4
- data/vendor/components/indefinido-indemma/lib/record/restfulable.js +45 -15
- data/vendor/components/indefinido-indemma/lib/record/scopable.js +13 -3
- data/vendor/components/indefinido-indemma/lib/record/validatable.js +20 -9
- data/vendor/components/indefinido-indemma/lib/record/validations/confirmation.js +1 -1
- data/vendor/components/indefinido-indemma/lib/record/validations/remote.js +6 -5
- data/vendor/components/indefinido-indemma/lib/record/validations/type.js +29 -0
- data/vendor/components/indefinido-indemma/lib/record.js +1 -11
- data/vendor/components/indefinido-indemma/spec/record/associable_spec.js +76 -0
- data/vendor/components/indefinido-indemma/spec/record/resource_spec.js +90 -0
- data/vendor/components/indefinido-indemma/spec/record/rest_spec.js +32 -0
- data/vendor/components/indefinido-indemma/spec/record/restfulable_spec.js +232 -0
- data/vendor/components/indefinido-indemma/spec/record/scopable_spec.js +201 -0
- data/vendor/components/indefinido-indemma/spec/record/translationable.js +28 -0
- data/vendor/components/indefinido-indemma/spec/record/validatable_spec.js +111 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/associated_spec.js +43 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/confirmation_spec.js +36 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/cpf_spec.js +35 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/presence_spec.js +28 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/remote_spec.js +86 -0
- data/vendor/components/indefinido-indemma/spec/record/validations/type_spec.js +48 -0
- data/vendor/components/indefinido-indemma/spec/record_spec.js +37 -0
- data/vendor/components/indefinido-indemma/spec/spec_helper.js +11 -0
- data/vendor/components/indefinido-indemma/spec/support/value_objects/phone.js +45 -0
- data/vendor/components/indefinido-indemma/src/lib/extensions/rivets.coffee +17 -0
- data/vendor/components/indefinido-indemma/src/lib/record/associable.coffee +173 -0
- data/vendor/components/indefinido-indemma/src/lib/record/errors.coffee +20 -0
- data/vendor/components/indefinido-indemma/src/lib/record/maid.coffee +16 -0
- data/vendor/components/indefinido-indemma/src/lib/record/resource.coffee +103 -0
- data/vendor/components/indefinido-indemma/src/lib/record/rest.coffee +28 -0
- data/vendor/components/indefinido-indemma/src/lib/record/restfulable.coffee +314 -0
- data/vendor/components/indefinido-indemma/src/lib/record/scopable.coffee +266 -0
- data/vendor/components/indefinido-indemma/src/lib/record/translationable.coffee +18 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validatable.coffee +209 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/associated.coffee +32 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/confirmation.coffee +19 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/cpf.coffee +58 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/presence.coffee +19 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/remote.coffee +65 -0
- data/vendor/components/indefinido-indemma/src/lib/record/validations/type.coffee +32 -0
- data/vendor/components/indefinido-indemma/src/lib/record.coffee +123 -0
- data/vendor/components/indefinido-indemma/src/spec/record/associable_spec.coffee +63 -0
- data/vendor/components/indefinido-indemma/src/spec/record/resource_spec.coffee +64 -0
- data/vendor/components/indefinido-indemma/src/spec/record/rest_spec.coffee +22 -0
- data/vendor/components/indefinido-indemma/src/spec/record/restfulable_spec.coffee +164 -0
- data/vendor/components/indefinido-indemma/src/spec/record/scopable_spec.coffee +181 -0
- data/vendor/components/indefinido-indemma/src/spec/record/translationable.coffee +19 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validatable_spec.coffee +100 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/associated_spec.coffee +35 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/confirmation_spec.coffee +25 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/cpf_spec.coffee +28 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/presence_spec.coffee +24 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/remote_spec.coffee +72 -0
- data/vendor/components/indefinido-indemma/src/spec/record/validations/type_spec.coffee +33 -0
- data/vendor/components/indefinido-indemma/src/spec/record_spec.coffee +23 -0
- data/vendor/components/indefinido-indemma/src/spec/spec_helper.coffee +9 -0
- data/vendor/components/indefinido-indemma/src/spec/support/value_objects/phone.coffee +30 -0
- data/vendor/components/indefinido-indemma/vendor/owl/pluralize.js +190 -0
- data/vendor/components/indefinido-observable/lib/observable.js +3 -0
- metadata +119 -2
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "indemma",
|
3
3
|
"repo": "indefinido/indemma",
|
4
4
|
"description": "Indemma (mind picture = memory), client side ES5 observable REST model",
|
5
|
-
"version": "0.
|
5
|
+
"version": "0.1.4",
|
6
6
|
"keywords": [],
|
7
7
|
"dependencies": {
|
8
8
|
"pluma/assimilate": "*",
|
@@ -10,17 +10,15 @@
|
|
10
10
|
"component/bind": "*",
|
11
11
|
"component/jquery": "*",
|
12
12
|
"indefinido/observable": "*",
|
13
|
-
"indefinido/advisable": "*"
|
14
|
-
"chaijs/chai": "*"
|
15
|
-
},
|
16
|
-
"development": {
|
17
|
-
"chaijs/chai": "*"
|
13
|
+
"indefinido/advisable": "*"
|
18
14
|
},
|
15
|
+
"development": {},
|
19
16
|
"license": "WTFPL",
|
20
17
|
"scripts": [
|
21
18
|
"index.js",
|
22
19
|
"vendor/stampit.js",
|
23
20
|
"vendor/sinon.js",
|
21
|
+
"vendor/owl/pluralize.js",
|
24
22
|
"lib/record.js",
|
25
23
|
"lib/record/associable.js",
|
26
24
|
"lib/record/resource.js",
|
@@ -29,12 +27,13 @@
|
|
29
27
|
"lib/record/scopable.js",
|
30
28
|
"lib/record/maid.js",
|
31
29
|
"lib/record/translationable.js",
|
32
|
-
"lib/record/validations/remote.js",
|
33
|
-
"lib/record/validations/presence.js",
|
34
30
|
"lib/record/validations/confirmation.js",
|
35
31
|
"lib/record/validations/associated.js",
|
32
|
+
"lib/record/validations/presence.js",
|
33
|
+
"lib/record/validations/remote.js",
|
34
|
+
"lib/record/validations/type.js",
|
36
35
|
"lib/record/validations/cpf.js",
|
37
36
|
"lib/record/validatable.js",
|
38
37
|
"lib/extensions/rivets.js"
|
39
38
|
]
|
40
|
-
}
|
39
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "assertion-error",
|
3
|
+
"repo": "chaijs/assertion-error",
|
4
|
+
"version": "1.0.0",
|
5
|
+
"description": "Error constructor for test and validation frameworks that implements standardized AssertionError specification.",
|
6
|
+
"license": "MIT",
|
7
|
+
"keywords": [
|
8
|
+
"test",
|
9
|
+
"assertion",
|
10
|
+
"assertion-error"
|
11
|
+
],
|
12
|
+
"main": "index.js",
|
13
|
+
"scripts": [
|
14
|
+
"index.js"
|
15
|
+
],
|
16
|
+
"dependencies": {},
|
17
|
+
"development": {}
|
18
|
+
}
|
@@ -0,0 +1,110 @@
|
|
1
|
+
/*!
|
2
|
+
* assertion-error
|
3
|
+
* Copyright(c) 2013 Jake Luer <jake@qualiancy.com>
|
4
|
+
* MIT Licensed
|
5
|
+
*/
|
6
|
+
|
7
|
+
/*!
|
8
|
+
* Return a function that will copy properties from
|
9
|
+
* one object to another excluding any originally
|
10
|
+
* listed. Returned function will create a new `{}`.
|
11
|
+
*
|
12
|
+
* @param {String} excluded properties ...
|
13
|
+
* @return {Function}
|
14
|
+
*/
|
15
|
+
|
16
|
+
function exclude () {
|
17
|
+
var excludes = [].slice.call(arguments);
|
18
|
+
|
19
|
+
function excludeProps (res, obj) {
|
20
|
+
Object.keys(obj).forEach(function (key) {
|
21
|
+
if (!~excludes.indexOf(key)) res[key] = obj[key];
|
22
|
+
});
|
23
|
+
}
|
24
|
+
|
25
|
+
return function extendExclude () {
|
26
|
+
var args = [].slice.call(arguments)
|
27
|
+
, i = 0
|
28
|
+
, res = {};
|
29
|
+
|
30
|
+
for (; i < args.length; i++) {
|
31
|
+
excludeProps(res, args[i]);
|
32
|
+
}
|
33
|
+
|
34
|
+
return res;
|
35
|
+
};
|
36
|
+
};
|
37
|
+
|
38
|
+
/*!
|
39
|
+
* Primary Exports
|
40
|
+
*/
|
41
|
+
|
42
|
+
module.exports = AssertionError;
|
43
|
+
|
44
|
+
/**
|
45
|
+
* ### AssertionError
|
46
|
+
*
|
47
|
+
* An extension of the JavaScript `Error` constructor for
|
48
|
+
* assertion and validation scenarios.
|
49
|
+
*
|
50
|
+
* @param {String} message
|
51
|
+
* @param {Object} properties to include (optional)
|
52
|
+
* @param {callee} start stack function (optional)
|
53
|
+
*/
|
54
|
+
|
55
|
+
function AssertionError (message, _props, ssf) {
|
56
|
+
var extend = exclude('name', 'message', 'stack', 'constructor', 'toJSON')
|
57
|
+
, props = extend(_props || {});
|
58
|
+
|
59
|
+
// default values
|
60
|
+
this.message = message || 'Unspecified AssertionError';
|
61
|
+
this.showDiff = false;
|
62
|
+
|
63
|
+
// copy from properties
|
64
|
+
for (var key in props) {
|
65
|
+
this[key] = props[key];
|
66
|
+
}
|
67
|
+
|
68
|
+
// capture stack trace
|
69
|
+
ssf = ssf || arguments.callee;
|
70
|
+
if (ssf && Error.captureStackTrace) {
|
71
|
+
Error.captureStackTrace(this, ssf);
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
/*!
|
76
|
+
* Inherit from Error.prototype
|
77
|
+
*/
|
78
|
+
|
79
|
+
AssertionError.prototype = Object.create(Error.prototype);
|
80
|
+
|
81
|
+
/*!
|
82
|
+
* Statically set name
|
83
|
+
*/
|
84
|
+
|
85
|
+
AssertionError.prototype.name = 'AssertionError';
|
86
|
+
|
87
|
+
/*!
|
88
|
+
* Ensure correct constructor
|
89
|
+
*/
|
90
|
+
|
91
|
+
AssertionError.prototype.constructor = AssertionError;
|
92
|
+
|
93
|
+
/**
|
94
|
+
* Allow errors to be converted to JSON for static transfer.
|
95
|
+
*
|
96
|
+
* @param {Boolean} include stack (default: `true`)
|
97
|
+
* @return {Object} object that can be `JSON.stringify`
|
98
|
+
*/
|
99
|
+
|
100
|
+
AssertionError.prototype.toJSON = function (stack) {
|
101
|
+
var extend = exclude('constructor', 'toJSON', 'stack')
|
102
|
+
, props = extend({ name: this.name }, this);
|
103
|
+
|
104
|
+
// include stack if exists and not turned off
|
105
|
+
if (false !== stack && this.stack) {
|
106
|
+
props.stack = this.stack;
|
107
|
+
}
|
108
|
+
|
109
|
+
return props;
|
110
|
+
};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
{
|
2
|
+
"name": "chai",
|
3
|
+
"repo": "chaijs/chai",
|
4
|
+
"version": "1.7.2",
|
5
|
+
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.",
|
6
|
+
"license": "MIT",
|
7
|
+
"keywords": [
|
8
|
+
"test",
|
9
|
+
"assertion",
|
10
|
+
"assert",
|
11
|
+
"testing",
|
12
|
+
"chai"
|
13
|
+
],
|
14
|
+
"main": "index.js",
|
15
|
+
"scripts": [
|
16
|
+
"index.js",
|
17
|
+
"lib/chai.js",
|
18
|
+
"lib/chai/assertion.js",
|
19
|
+
"lib/chai/core/assertions.js",
|
20
|
+
"lib/chai/interface/assert.js",
|
21
|
+
"lib/chai/interface/expect.js",
|
22
|
+
"lib/chai/interface/should.js",
|
23
|
+
"lib/chai/utils/addChainableMethod.js",
|
24
|
+
"lib/chai/utils/addMethod.js",
|
25
|
+
"lib/chai/utils/addProperty.js",
|
26
|
+
"lib/chai/utils/eql.js",
|
27
|
+
"lib/chai/utils/flag.js",
|
28
|
+
"lib/chai/utils/getActual.js",
|
29
|
+
"lib/chai/utils/getEnumerableProperties.js",
|
30
|
+
"lib/chai/utils/getMessage.js",
|
31
|
+
"lib/chai/utils/getName.js",
|
32
|
+
"lib/chai/utils/getPathValue.js",
|
33
|
+
"lib/chai/utils/getProperties.js",
|
34
|
+
"lib/chai/utils/index.js",
|
35
|
+
"lib/chai/utils/inspect.js",
|
36
|
+
"lib/chai/utils/objDisplay.js",
|
37
|
+
"lib/chai/utils/overwriteMethod.js",
|
38
|
+
"lib/chai/utils/overwriteProperty.js",
|
39
|
+
"lib/chai/utils/test.js",
|
40
|
+
"lib/chai/utils/transferFlags.js",
|
41
|
+
"lib/chai/utils/type.js"
|
42
|
+
],
|
43
|
+
"dependencies": {
|
44
|
+
"chaijs/assertion-error": "1.0.0"
|
45
|
+
},
|
46
|
+
"development": {}
|
47
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
module.exports = require('./lib/chai');
|
@@ -0,0 +1,130 @@
|
|
1
|
+
/*!
|
2
|
+
* chai
|
3
|
+
* http://chaijs.com
|
4
|
+
* Copyright(c) 2011-2013 Jake Luer <jake@alogicalparadox.com>
|
5
|
+
* MIT Licensed
|
6
|
+
*/
|
7
|
+
|
8
|
+
module.exports = function (_chai, util) {
|
9
|
+
/*!
|
10
|
+
* Module dependencies.
|
11
|
+
*/
|
12
|
+
|
13
|
+
var AssertionError = _chai.AssertionError
|
14
|
+
, flag = util.flag;
|
15
|
+
|
16
|
+
/*!
|
17
|
+
* Module export.
|
18
|
+
*/
|
19
|
+
|
20
|
+
_chai.Assertion = Assertion;
|
21
|
+
|
22
|
+
/*!
|
23
|
+
* Assertion Constructor
|
24
|
+
*
|
25
|
+
* Creates object for chaining.
|
26
|
+
*
|
27
|
+
* @api private
|
28
|
+
*/
|
29
|
+
|
30
|
+
function Assertion (obj, msg, stack) {
|
31
|
+
flag(this, 'ssfi', stack || arguments.callee);
|
32
|
+
flag(this, 'object', obj);
|
33
|
+
flag(this, 'message', msg);
|
34
|
+
}
|
35
|
+
|
36
|
+
/*!
|
37
|
+
* ### Assertion.includeStack
|
38
|
+
*
|
39
|
+
* User configurable property, influences whether stack trace
|
40
|
+
* is included in Assertion error message. Default of false
|
41
|
+
* suppresses stack trace in the error message
|
42
|
+
*
|
43
|
+
* Assertion.includeStack = true; // enable stack on error
|
44
|
+
*
|
45
|
+
* @api public
|
46
|
+
*/
|
47
|
+
|
48
|
+
Assertion.includeStack = false;
|
49
|
+
|
50
|
+
/*!
|
51
|
+
* ### Assertion.showDiff
|
52
|
+
*
|
53
|
+
* User configurable property, influences whether or not
|
54
|
+
* the `showDiff` flag should be included in the thrown
|
55
|
+
* AssertionErrors. `false` will always be `false`; `true`
|
56
|
+
* will be true when the assertion has requested a diff
|
57
|
+
* be shown.
|
58
|
+
*
|
59
|
+
* @api public
|
60
|
+
*/
|
61
|
+
|
62
|
+
Assertion.showDiff = true;
|
63
|
+
|
64
|
+
Assertion.addProperty = function (name, fn) {
|
65
|
+
util.addProperty(this.prototype, name, fn);
|
66
|
+
};
|
67
|
+
|
68
|
+
Assertion.addMethod = function (name, fn) {
|
69
|
+
util.addMethod(this.prototype, name, fn);
|
70
|
+
};
|
71
|
+
|
72
|
+
Assertion.addChainableMethod = function (name, fn, chainingBehavior) {
|
73
|
+
util.addChainableMethod(this.prototype, name, fn, chainingBehavior);
|
74
|
+
};
|
75
|
+
|
76
|
+
Assertion.overwriteProperty = function (name, fn) {
|
77
|
+
util.overwriteProperty(this.prototype, name, fn);
|
78
|
+
};
|
79
|
+
|
80
|
+
Assertion.overwriteMethod = function (name, fn) {
|
81
|
+
util.overwriteMethod(this.prototype, name, fn);
|
82
|
+
};
|
83
|
+
|
84
|
+
/*!
|
85
|
+
* ### .assert(expression, message, negateMessage, expected, actual)
|
86
|
+
*
|
87
|
+
* Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass.
|
88
|
+
*
|
89
|
+
* @name assert
|
90
|
+
* @param {Philosophical} expression to be tested
|
91
|
+
* @param {String} message to display if fails
|
92
|
+
* @param {String} negatedMessage to display if negated expression fails
|
93
|
+
* @param {Mixed} expected value (remember to check for negation)
|
94
|
+
* @param {Mixed} actual (optional) will default to `this.obj`
|
95
|
+
* @api private
|
96
|
+
*/
|
97
|
+
|
98
|
+
Assertion.prototype.assert = function (expr, msg, negateMsg, expected, _actual, showDiff) {
|
99
|
+
var ok = util.test(this, arguments);
|
100
|
+
if (true !== showDiff) showDiff = false;
|
101
|
+
if (true !== Assertion.showDiff) showDiff = false;
|
102
|
+
|
103
|
+
if (!ok) {
|
104
|
+
var msg = util.getMessage(this, arguments)
|
105
|
+
, actual = util.getActual(this, arguments);
|
106
|
+
throw new AssertionError(msg, {
|
107
|
+
actual: actual
|
108
|
+
, expected: expected
|
109
|
+
, showDiff: showDiff
|
110
|
+
}, (Assertion.includeStack) ? this.assert : flag(this, 'ssfi'));
|
111
|
+
}
|
112
|
+
};
|
113
|
+
|
114
|
+
/*!
|
115
|
+
* ### ._obj
|
116
|
+
*
|
117
|
+
* Quick reference to stored `actual` value for plugin developers.
|
118
|
+
*
|
119
|
+
* @api private
|
120
|
+
*/
|
121
|
+
|
122
|
+
Object.defineProperty(Assertion.prototype, '_obj',
|
123
|
+
{ get: function () {
|
124
|
+
return flag(this, 'object');
|
125
|
+
}
|
126
|
+
, set: function (val) {
|
127
|
+
flag(this, 'object', val);
|
128
|
+
}
|
129
|
+
});
|
130
|
+
};
|