chai-rails 1.8.1 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/assets/javascripts/chai.js +151 -68
- data/lib/chai/rails/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d12361819b7f275318c749284c1f66e3a237cae
|
4
|
+
data.tar.gz: a48e2117f221a6968d11b8a0e7d5143929cdbb02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d3452104b0804af3db284396a673db00d42059e082aaf0095bb0921eb5a7fa5468420e0bdf189930ac394c65a76acdef99c352af5decdc5490c57139193002f
|
7
|
+
data.tar.gz: f60d4ed212f5c1eb09548a3f3e6e1170351bdf78f570027aaf168e18e24061266ca5ba4d5c8bd00801e9b036cd2c7aaf5842ae148b50b320099431437b3072a4
|
data/README.md
CHANGED
@@ -725,7 +725,7 @@ module.exports = require('./lib/chai');
|
|
725
725
|
require.register("chai/lib/chai.js", function(exports, require, module){
|
726
726
|
/*!
|
727
727
|
* chai
|
728
|
-
* Copyright(c) 2011-
|
728
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
729
729
|
* MIT Licensed
|
730
730
|
*/
|
731
731
|
|
@@ -809,7 +809,7 @@ require.register("chai/lib/chai/assertion.js", function(exports, require, module
|
|
809
809
|
/*!
|
810
810
|
* chai
|
811
811
|
* http://chaijs.com
|
812
|
-
* Copyright(c) 2011-
|
812
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
813
813
|
* MIT Licensed
|
814
814
|
*/
|
815
815
|
|
@@ -889,6 +889,10 @@ module.exports = function (_chai, util) {
|
|
889
889
|
util.overwriteMethod(this.prototype, name, fn);
|
890
890
|
};
|
891
891
|
|
892
|
+
Assertion.overwriteChainableMethod = function (name, fn, chainingBehavior) {
|
893
|
+
util.overwriteChainableMethod(this.prototype, name, fn, chainingBehavior);
|
894
|
+
};
|
895
|
+
|
892
896
|
/*!
|
893
897
|
* ### .assert(expression, message, negateMessage, expected, actual)
|
894
898
|
*
|
@@ -942,7 +946,7 @@ require.register("chai/lib/chai/core/assertions.js", function(exports, require,
|
|
942
946
|
/*!
|
943
947
|
* chai
|
944
948
|
* http://chaijs.com
|
945
|
-
* Copyright(c) 2011-
|
949
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
946
950
|
* MIT Licensed
|
947
951
|
*/
|
948
952
|
|
@@ -954,7 +958,7 @@ module.exports = function (chai, _) {
|
|
954
958
|
/**
|
955
959
|
* ### Language Chains
|
956
960
|
*
|
957
|
-
* The following are
|
961
|
+
* The following are provided as chainable getters to
|
958
962
|
* improve the readability of your assertions. They
|
959
963
|
* do not provide an testing capability unless they
|
960
964
|
* have been overwritten by a plugin.
|
@@ -967,6 +971,7 @@ module.exports = function (chai, _) {
|
|
967
971
|
* - is
|
968
972
|
* - that
|
969
973
|
* - and
|
974
|
+
* - has
|
970
975
|
* - have
|
971
976
|
* - with
|
972
977
|
* - at
|
@@ -978,7 +983,7 @@ module.exports = function (chai, _) {
|
|
978
983
|
*/
|
979
984
|
|
980
985
|
[ 'to', 'be', 'been'
|
981
|
-
, 'is', 'and', 'have'
|
986
|
+
, 'is', 'and', 'has', 'have'
|
982
987
|
, 'with', 'that', 'at'
|
983
988
|
, 'of', 'same' ].forEach(function (chain) {
|
984
989
|
Assertion.addProperty(chain, function () {
|
@@ -1086,9 +1091,21 @@ module.exports = function (chai, _) {
|
|
1086
1091
|
|
1087
1092
|
function include (val, msg) {
|
1088
1093
|
if (msg) flag(this, 'message', msg);
|
1089
|
-
var obj = flag(this, 'object')
|
1094
|
+
var obj = flag(this, 'object');
|
1095
|
+
|
1096
|
+
if (_.type(val) === 'object') {
|
1097
|
+
if (!flag(this, 'negate')) {
|
1098
|
+
for (var k in val) new Assertion(obj).property(k, val[k]);
|
1099
|
+
return;
|
1100
|
+
}
|
1101
|
+
var subset = {}
|
1102
|
+
for (var k in val) subset[k] = obj[k]
|
1103
|
+
var expected = _.eql(subset, val);
|
1104
|
+
} else {
|
1105
|
+
var expected = obj && ~obj.indexOf(val)
|
1106
|
+
}
|
1090
1107
|
this.assert(
|
1091
|
-
|
1108
|
+
expected
|
1092
1109
|
, 'expected #{this} to include ' + _.inspect(val)
|
1093
1110
|
, 'expected #{this} to not include ' + _.inspect(val));
|
1094
1111
|
}
|
@@ -1943,6 +1960,7 @@ module.exports = function (chai, _) {
|
|
1943
1960
|
* @param {String|RegExp} expected error message
|
1944
1961
|
* @param {String} message _optional_
|
1945
1962
|
* @see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error#Error_types
|
1963
|
+
* @returns error for chaining (null if no error)
|
1946
1964
|
* @api public
|
1947
1965
|
*/
|
1948
1966
|
|
@@ -1967,7 +1985,10 @@ module.exports = function (chai, _) {
|
|
1967
1985
|
constructor = null;
|
1968
1986
|
errMsg = null;
|
1969
1987
|
} else if (typeof constructor === 'function') {
|
1970
|
-
name =
|
1988
|
+
name = constructor.prototype.name || constructor.name;
|
1989
|
+
if (name === 'Error' && constructor !== Error) {
|
1990
|
+
name = (new constructor()).name;
|
1991
|
+
}
|
1971
1992
|
} else {
|
1972
1993
|
constructor = null;
|
1973
1994
|
}
|
@@ -1981,12 +2002,14 @@ module.exports = function (chai, _) {
|
|
1981
2002
|
err === desiredError
|
1982
2003
|
, 'expected #{this} to throw #{exp} but #{act} was thrown'
|
1983
2004
|
, 'expected #{this} to not throw #{exp}'
|
1984
|
-
, desiredError
|
1985
|
-
, err
|
2005
|
+
, (desiredError instanceof Error ? desiredError.toString() : desiredError)
|
2006
|
+
, (err instanceof Error ? err.toString() : err)
|
1986
2007
|
);
|
1987
2008
|
|
2009
|
+
flag(this, 'object', err);
|
1988
2010
|
return this;
|
1989
2011
|
}
|
2012
|
+
|
1990
2013
|
// next, check constructor
|
1991
2014
|
if (constructor) {
|
1992
2015
|
this.assert(
|
@@ -1994,11 +2017,15 @@ module.exports = function (chai, _) {
|
|
1994
2017
|
, 'expected #{this} to throw #{exp} but #{act} was thrown'
|
1995
2018
|
, 'expected #{this} to not throw #{exp} but #{act} was thrown'
|
1996
2019
|
, name
|
1997
|
-
, err
|
2020
|
+
, (err instanceof Error ? err.toString() : err)
|
1998
2021
|
);
|
1999
2022
|
|
2000
|
-
if (!errMsg)
|
2023
|
+
if (!errMsg) {
|
2024
|
+
flag(this, 'object', err);
|
2025
|
+
return this;
|
2026
|
+
}
|
2001
2027
|
}
|
2028
|
+
|
2002
2029
|
// next, check message
|
2003
2030
|
var message = 'object' === _.type(err) && "message" in err
|
2004
2031
|
? err.message
|
@@ -2013,6 +2040,7 @@ module.exports = function (chai, _) {
|
|
2013
2040
|
, message
|
2014
2041
|
);
|
2015
2042
|
|
2043
|
+
flag(this, 'object', err);
|
2016
2044
|
return this;
|
2017
2045
|
} else if ((message != null) && errMsg && 'string' === typeof errMsg) {
|
2018
2046
|
this.assert(
|
@@ -2023,6 +2051,7 @@ module.exports = function (chai, _) {
|
|
2023
2051
|
, message
|
2024
2052
|
);
|
2025
2053
|
|
2054
|
+
flag(this, 'object', err);
|
2026
2055
|
return this;
|
2027
2056
|
} else {
|
2028
2057
|
thrown = true;
|
@@ -2045,9 +2074,11 @@ module.exports = function (chai, _) {
|
|
2045
2074
|
thrown === true
|
2046
2075
|
, 'expected #{this} to throw ' + expectedThrown + actuallyGot
|
2047
2076
|
, 'expected #{this} to not throw ' + expectedThrown + actuallyGot
|
2048
|
-
, desiredError
|
2049
|
-
, thrownError
|
2077
|
+
, (desiredError instanceof Error ? desiredError.toString() : desiredError)
|
2078
|
+
, (thrownError instanceof Error ? thrownError.toString() : thrownError)
|
2050
2079
|
);
|
2080
|
+
|
2081
|
+
flag(this, 'object', thrownError);
|
2051
2082
|
};
|
2052
2083
|
|
2053
2084
|
Assertion.addMethod('throw', assertThrows);
|
@@ -2214,7 +2245,7 @@ module.exports = function (chai, _) {
|
|
2214
2245
|
require.register("chai/lib/chai/interface/assert.js", function(exports, require, module){
|
2215
2246
|
/*!
|
2216
2247
|
* chai
|
2217
|
-
* Copyright(c) 2011-
|
2248
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
2218
2249
|
* MIT Licensed
|
2219
2250
|
*/
|
2220
2251
|
|
@@ -2269,13 +2300,12 @@ module.exports = function (chai, util) {
|
|
2269
2300
|
*/
|
2270
2301
|
|
2271
2302
|
assert.fail = function (actual, expected, message, operator) {
|
2272
|
-
|
2303
|
+
message = message || 'assert.fail()';
|
2304
|
+
throw new chai.AssertionError(message, {
|
2273
2305
|
actual: actual
|
2274
2306
|
, expected: expected
|
2275
|
-
, message: message
|
2276
2307
|
, operator: operator
|
2277
|
-
|
2278
|
-
});
|
2308
|
+
}, assert.fail);
|
2279
2309
|
};
|
2280
2310
|
|
2281
2311
|
/**
|
@@ -2871,19 +2901,7 @@ module.exports = function (chai, util) {
|
|
2871
2901
|
*/
|
2872
2902
|
|
2873
2903
|
assert.include = function (exp, inc, msg) {
|
2874
|
-
|
2875
|
-
|
2876
|
-
if (Array.isArray(exp)) {
|
2877
|
-
obj.to.include(inc);
|
2878
|
-
} else if ('string' === typeof exp) {
|
2879
|
-
obj.to.contain.string(inc);
|
2880
|
-
} else {
|
2881
|
-
throw new chai.AssertionError(
|
2882
|
-
'expected an array or string'
|
2883
|
-
, null
|
2884
|
-
, assert.include
|
2885
|
-
);
|
2886
|
-
}
|
2904
|
+
new Assertion(exp, msg).include(inc);
|
2887
2905
|
};
|
2888
2906
|
|
2889
2907
|
/**
|
@@ -2903,19 +2921,7 @@ module.exports = function (chai, util) {
|
|
2903
2921
|
*/
|
2904
2922
|
|
2905
2923
|
assert.notInclude = function (exp, inc, msg) {
|
2906
|
-
|
2907
|
-
|
2908
|
-
if (Array.isArray(exp)) {
|
2909
|
-
obj.to.not.include(inc);
|
2910
|
-
} else if ('string' === typeof exp) {
|
2911
|
-
obj.to.not.contain.string(inc);
|
2912
|
-
} else {
|
2913
|
-
throw new chai.AssertionError(
|
2914
|
-
'expected an array or string'
|
2915
|
-
, null
|
2916
|
-
, assert.notInclude
|
2917
|
-
);
|
2918
|
-
}
|
2924
|
+
new Assertion(exp, msg).not.include(inc);
|
2919
2925
|
};
|
2920
2926
|
|
2921
2927
|
/**
|
@@ -3159,7 +3165,8 @@ module.exports = function (chai, util) {
|
|
3159
3165
|
errt = null;
|
3160
3166
|
}
|
3161
3167
|
|
3162
|
-
new Assertion(fn, msg).to.Throw(errt, errs);
|
3168
|
+
var assertErr = new Assertion(fn, msg).to.Throw(errt, errs);
|
3169
|
+
return flag(assertErr, 'object');
|
3163
3170
|
};
|
3164
3171
|
|
3165
3172
|
/**
|
@@ -3297,7 +3304,7 @@ module.exports = function (chai, util) {
|
|
3297
3304
|
require.register("chai/lib/chai/interface/expect.js", function(exports, require, module){
|
3298
3305
|
/*!
|
3299
3306
|
* chai
|
3300
|
-
* Copyright(c) 2011-
|
3307
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
3301
3308
|
* MIT Licensed
|
3302
3309
|
*/
|
3303
3310
|
|
@@ -3312,7 +3319,7 @@ module.exports = function (chai, util) {
|
|
3312
3319
|
require.register("chai/lib/chai/interface/should.js", function(exports, require, module){
|
3313
3320
|
/*!
|
3314
3321
|
* chai
|
3315
|
-
* Copyright(c) 2011-
|
3322
|
+
* Copyright(c) 2011-2014 Jake Luer <jake@alogicalparadox.com>
|
3316
3323
|
* MIT Licensed
|
3317
3324
|
*/
|
3318
3325
|
|
@@ -3391,7 +3398,7 @@ module.exports = function (chai, util) {
|
|
3391
3398
|
require.register("chai/lib/chai/utils/addChainableMethod.js", function(exports, require, module){
|
3392
3399
|
/*!
|
3393
3400
|
* Chai - addChainingMethod utility
|
3394
|
-
* Copyright(c) 2012-
|
3401
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3395
3402
|
* MIT Licensed
|
3396
3403
|
*/
|
3397
3404
|
|
@@ -3446,15 +3453,27 @@ var call = Function.prototype.call,
|
|
3446
3453
|
*/
|
3447
3454
|
|
3448
3455
|
module.exports = function (ctx, name, method, chainingBehavior) {
|
3449
|
-
if (typeof chainingBehavior !== 'function')
|
3456
|
+
if (typeof chainingBehavior !== 'function') {
|
3450
3457
|
chainingBehavior = function () { };
|
3458
|
+
}
|
3459
|
+
|
3460
|
+
var chainableBehavior = {
|
3461
|
+
method: method
|
3462
|
+
, chainingBehavior: chainingBehavior
|
3463
|
+
};
|
3464
|
+
|
3465
|
+
// save the methods so we can overwrite them later, if we need to.
|
3466
|
+
if (!ctx.__methods) {
|
3467
|
+
ctx.__methods = {};
|
3468
|
+
}
|
3469
|
+
ctx.__methods[name] = chainableBehavior;
|
3451
3470
|
|
3452
3471
|
Object.defineProperty(ctx, name,
|
3453
3472
|
{ get: function () {
|
3454
|
-
chainingBehavior.call(this);
|
3473
|
+
chainableBehavior.chainingBehavior.call(this);
|
3455
3474
|
|
3456
3475
|
var assert = function () {
|
3457
|
-
var result = method.apply(this, arguments);
|
3476
|
+
var result = chainableBehavior.method.apply(this, arguments);
|
3458
3477
|
return result === undefined ? this : result;
|
3459
3478
|
};
|
3460
3479
|
|
@@ -3488,7 +3507,7 @@ module.exports = function (ctx, name, method, chainingBehavior) {
|
|
3488
3507
|
require.register("chai/lib/chai/utils/addMethod.js", function(exports, require, module){
|
3489
3508
|
/*!
|
3490
3509
|
* Chai - addMethod utility
|
3491
|
-
* Copyright(c) 2012-
|
3510
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3492
3511
|
* MIT Licensed
|
3493
3512
|
*/
|
3494
3513
|
|
@@ -3528,7 +3547,7 @@ module.exports = function (ctx, name, method) {
|
|
3528
3547
|
require.register("chai/lib/chai/utils/addProperty.js", function(exports, require, module){
|
3529
3548
|
/*!
|
3530
3549
|
* Chai - addProperty utility
|
3531
|
-
* Copyright(c) 2012-
|
3550
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3532
3551
|
* MIT Licensed
|
3533
3552
|
*/
|
3534
3553
|
|
@@ -3571,7 +3590,7 @@ module.exports = function (ctx, name, getter) {
|
|
3571
3590
|
require.register("chai/lib/chai/utils/flag.js", function(exports, require, module){
|
3572
3591
|
/*!
|
3573
3592
|
* Chai - flag utility
|
3574
|
-
* Copyright(c) 2012-
|
3593
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3575
3594
|
* MIT Licensed
|
3576
3595
|
*/
|
3577
3596
|
|
@@ -3606,7 +3625,7 @@ module.exports = function (obj, key, value) {
|
|
3606
3625
|
require.register("chai/lib/chai/utils/getActual.js", function(exports, require, module){
|
3607
3626
|
/*!
|
3608
3627
|
* Chai - getActual utility
|
3609
|
-
* Copyright(c) 2012-
|
3628
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3610
3629
|
* MIT Licensed
|
3611
3630
|
*/
|
3612
3631
|
|
@@ -3628,7 +3647,7 @@ module.exports = function (obj, args) {
|
|
3628
3647
|
require.register("chai/lib/chai/utils/getEnumerableProperties.js", function(exports, require, module){
|
3629
3648
|
/*!
|
3630
3649
|
* Chai - getEnumerableProperties utility
|
3631
|
-
* Copyright(c) 2012-
|
3650
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3632
3651
|
* MIT Licensed
|
3633
3652
|
*/
|
3634
3653
|
|
@@ -3656,7 +3675,7 @@ module.exports = function getEnumerableProperties(object) {
|
|
3656
3675
|
require.register("chai/lib/chai/utils/getMessage.js", function(exports, require, module){
|
3657
3676
|
/*!
|
3658
3677
|
* Chai - message composition utility
|
3659
|
-
* Copyright(c) 2012-
|
3678
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3660
3679
|
* MIT Licensed
|
3661
3680
|
*/
|
3662
3681
|
|
@@ -3708,7 +3727,7 @@ module.exports = function (obj, args) {
|
|
3708
3727
|
require.register("chai/lib/chai/utils/getName.js", function(exports, require, module){
|
3709
3728
|
/*!
|
3710
3729
|
* Chai - getName utility
|
3711
|
-
* Copyright(c) 2012-
|
3730
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3712
3731
|
* MIT Licensed
|
3713
3732
|
*/
|
3714
3733
|
|
@@ -3731,7 +3750,7 @@ module.exports = function (func) {
|
|
3731
3750
|
require.register("chai/lib/chai/utils/getPathValue.js", function(exports, require, module){
|
3732
3751
|
/*!
|
3733
3752
|
* Chai - getPathValue utility
|
3734
|
-
* Copyright(c) 2012-
|
3753
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3735
3754
|
* @see https://github.com/logicalparadox/filtr
|
3736
3755
|
* MIT Licensed
|
3737
3756
|
*/
|
@@ -3836,7 +3855,7 @@ function _getPathValue (parsed, obj) {
|
|
3836
3855
|
require.register("chai/lib/chai/utils/getProperties.js", function(exports, require, module){
|
3837
3856
|
/*!
|
3838
3857
|
* Chai - getProperties utility
|
3839
|
-
* Copyright(c) 2012-
|
3858
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
3840
3859
|
* MIT Licensed
|
3841
3860
|
*/
|
3842
3861
|
|
@@ -3980,6 +3999,12 @@ exports.overwriteMethod = require('./overwriteMethod');
|
|
3980
3999
|
|
3981
4000
|
exports.addChainableMethod = require('./addChainableMethod');
|
3982
4001
|
|
4002
|
+
/*!
|
4003
|
+
* Overwrite chainable method
|
4004
|
+
*/
|
4005
|
+
|
4006
|
+
exports.overwriteChainableMethod = require('./overwriteChainableMethod');
|
4007
|
+
|
3983
4008
|
|
3984
4009
|
});
|
3985
4010
|
require.register("chai/lib/chai/utils/inspect.js", function(exports, require, module){
|
@@ -4308,7 +4333,7 @@ function objectToString(o) {
|
|
4308
4333
|
require.register("chai/lib/chai/utils/objDisplay.js", function(exports, require, module){
|
4309
4334
|
/*!
|
4310
4335
|
* Chai - flag utility
|
4311
|
-
* Copyright(c) 2012-
|
4336
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4312
4337
|
* MIT Licensed
|
4313
4338
|
*/
|
4314
4339
|
|
@@ -4359,7 +4384,7 @@ module.exports = function (obj) {
|
|
4359
4384
|
require.register("chai/lib/chai/utils/overwriteMethod.js", function(exports, require, module){
|
4360
4385
|
/*!
|
4361
4386
|
* Chai - overwriteMethod utility
|
4362
|
-
* Copyright(c) 2012-
|
4387
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4363
4388
|
* MIT Licensed
|
4364
4389
|
*/
|
4365
4390
|
|
@@ -4413,7 +4438,7 @@ module.exports = function (ctx, name, method) {
|
|
4413
4438
|
require.register("chai/lib/chai/utils/overwriteProperty.js", function(exports, require, module){
|
4414
4439
|
/*!
|
4415
4440
|
* Chai - overwriteProperty utility
|
4416
|
-
* Copyright(c) 2012-
|
4441
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4417
4442
|
* MIT Licensed
|
4418
4443
|
*/
|
4419
4444
|
|
@@ -4466,11 +4491,67 @@ module.exports = function (ctx, name, getter) {
|
|
4466
4491
|
});
|
4467
4492
|
};
|
4468
4493
|
|
4494
|
+
});
|
4495
|
+
require.register("chai/lib/chai/utils/overwriteChainableMethod.js", function(exports, require, module){
|
4496
|
+
/*!
|
4497
|
+
* Chai - overwriteChainableMethod utility
|
4498
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4499
|
+
* MIT Licensed
|
4500
|
+
*/
|
4501
|
+
|
4502
|
+
/**
|
4503
|
+
* ### overwriteChainableMethod (ctx, name, fn)
|
4504
|
+
*
|
4505
|
+
* Overwites an already existing chainable method
|
4506
|
+
* and provides access to the previous function or
|
4507
|
+
* property. Must return functions to be used for
|
4508
|
+
* name.
|
4509
|
+
*
|
4510
|
+
* utils.overwriteChainableMethod(chai.Assertion.prototype, 'length',
|
4511
|
+
* function (_super) {
|
4512
|
+
* }
|
4513
|
+
* , function (_super) {
|
4514
|
+
* }
|
4515
|
+
* );
|
4516
|
+
*
|
4517
|
+
* Can also be accessed directly from `chai.Assertion`.
|
4518
|
+
*
|
4519
|
+
* chai.Assertion.overwriteChainableMethod('foo', fn, fn);
|
4520
|
+
*
|
4521
|
+
* Then can be used as any other assertion.
|
4522
|
+
*
|
4523
|
+
* expect(myFoo).to.have.length(3);
|
4524
|
+
* expect(myFoo).to.have.length.above(3);
|
4525
|
+
*
|
4526
|
+
* @param {Object} ctx object whose method / property is to be overwritten
|
4527
|
+
* @param {String} name of method / property to overwrite
|
4528
|
+
* @param {Function} method function that returns a function to be used for name
|
4529
|
+
* @param {Function} chainingBehavior function that returns a function to be used for property
|
4530
|
+
* @name overwriteChainableMethod
|
4531
|
+
* @api public
|
4532
|
+
*/
|
4533
|
+
|
4534
|
+
module.exports = function (ctx, name, method, chainingBehavior) {
|
4535
|
+
var chainableBehavior = ctx.__methods[name];
|
4536
|
+
|
4537
|
+
var _chainingBehavior = chainableBehavior.chainingBehavior;
|
4538
|
+
chainableBehavior.chainingBehavior = function () {
|
4539
|
+
var result = chainingBehavior(_chainingBehavior).call(this);
|
4540
|
+
return result === undefined ? this : result;
|
4541
|
+
};
|
4542
|
+
|
4543
|
+
var _method = chainableBehavior.method;
|
4544
|
+
chainableBehavior.method = function () {
|
4545
|
+
var result = method(_method).apply(this, arguments);
|
4546
|
+
return result === undefined ? this : result;
|
4547
|
+
};
|
4548
|
+
};
|
4549
|
+
|
4469
4550
|
});
|
4470
4551
|
require.register("chai/lib/chai/utils/test.js", function(exports, require, module){
|
4471
4552
|
/*!
|
4472
4553
|
* Chai - test utility
|
4473
|
-
* Copyright(c) 2012-
|
4554
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4474
4555
|
* MIT Licensed
|
4475
4556
|
*/
|
4476
4557
|
|
@@ -4499,7 +4580,7 @@ module.exports = function (obj, args) {
|
|
4499
4580
|
require.register("chai/lib/chai/utils/transferFlags.js", function(exports, require, module){
|
4500
4581
|
/*!
|
4501
4582
|
* Chai - transferFlags utility
|
4502
|
-
* Copyright(c) 2012-
|
4583
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4503
4584
|
* MIT Licensed
|
4504
4585
|
*/
|
4505
4586
|
|
@@ -4546,7 +4627,7 @@ module.exports = function (assertion, object, includeAll) {
|
|
4546
4627
|
require.register("chai/lib/chai/utils/type.js", function(exports, require, module){
|
4547
4628
|
/*!
|
4548
4629
|
* Chai - type utility
|
4549
|
-
* Copyright(c) 2012-
|
4630
|
+
* Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
|
4550
4631
|
* MIT Licensed
|
4551
4632
|
*/
|
4552
4633
|
|
@@ -4593,6 +4674,8 @@ module.exports = function (obj) {
|
|
4593
4674
|
});
|
4594
4675
|
|
4595
4676
|
|
4677
|
+
|
4678
|
+
|
4596
4679
|
require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
|
4597
4680
|
require.alias("chaijs-assertion-error/index.js", "chai/deps/assertion-error/index.js");
|
4598
4681
|
require.alias("chaijs-assertion-error/index.js", "assertion-error/index.js");
|
@@ -4607,7 +4690,7 @@ require.alias("chaijs-deep-eql/lib/eql.js", "chaijs-deep-eql/index.js");
|
|
4607
4690
|
require.alias("chai/index.js", "chai/index.js");if (typeof exports == "object") {
|
4608
4691
|
module.exports = require("chai");
|
4609
4692
|
} else if (typeof define == "function" && define.amd) {
|
4610
|
-
define(function(){ return require("chai"); });
|
4693
|
+
define([], function(){ return require("chai"); });
|
4611
4694
|
} else {
|
4612
4695
|
this["chai"] = require("chai");
|
4613
4696
|
}})();
|
data/lib/chai/rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chai-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey Plutalov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.1'
|
27
27
|
description:
|
@@ -31,7 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
-
|
34
|
+
- .gitignore
|
35
35
|
- Gemfile
|
36
36
|
- LICENSE.txt
|
37
37
|
- README.md
|
@@ -50,12 +50,12 @@ require_paths:
|
|
50
50
|
- lib
|
51
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
|
-
- -
|
53
|
+
- - '>='
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- -
|
58
|
+
- - '>='
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
61
|
requirements: []
|
@@ -65,3 +65,4 @@ signing_key:
|
|
65
65
|
specification_version: 4
|
66
66
|
summary: Chai via assets pipeline
|
67
67
|
test_files: []
|
68
|
+
has_rdoc:
|