konacha 3.6.0 → 3.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1097ffb8579de0dac384f4b2c4dff41b98c415b
4
- data.tar.gz: f255c6f248373b15c118c701d5687089b57074b8
3
+ metadata.gz: 97bd31bc543a9f6f2c85d3109b3516554762fc10
4
+ data.tar.gz: 9c77a26680c19837ffd8e28218cd76be31e288cf
5
5
  SHA512:
6
- metadata.gz: c6b1f325470173a3ac70b7200ca9f045fcefe095838ef044d0de0856f690a9472c67c384448ed9f2d20d4d3c2f35a3ffbb5464bcd3dc975ef5f8adac51b9a068
7
- data.tar.gz: 765ceec49d9d4ed49de28fb2514fac317d25a7dd8a2e860b00938a79949a86f9c7cb41d5d4210cd4e8518a431397fac7517d30e5ef67e3778be3d3cd6ac33d24
6
+ metadata.gz: a5034521ce296215be8e5ce6b362389c50e2a3d439155df07d0378bddd7017dc99c416aa9b15d761bcb4e492387ae1ee99fbd43f54717d020b113f03bd01152b
7
+ data.tar.gz: 1cea843ff0fc9563aaf7c66fe1fdb5888e4146dcb56c8c7d7cacb7a6792687a72c229e119c69a543a4924cd9a517c4f64b3cea6c21561d0a3e44b55433511c48
data/History.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # master
2
2
 
3
+ # 3.7.0
4
+
5
+ * Update chai (3.3.0) and mocha (2.3.2)
6
+
3
7
  # 3.6.0
4
8
 
5
9
  * Update chai (3.0.0) and mocha (2.3.0)
@@ -17,7 +17,7 @@ the asset pipeline and engines.}
17
17
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  gem.name = "konacha"
19
19
  gem.require_paths = ["lib"]
20
- gem.version = "3.6.0"
20
+ gem.version = "3.7.0"
21
21
  gem.license = "MIT"
22
22
 
23
23
  gem.add_dependency "railties", ">= 3.1", "< 5"
@@ -15,7 +15,7 @@ var used = []
15
15
  * Chai version
16
16
  */
17
17
 
18
- exports.version = '3.0.0';
18
+ exports.version = '3.3.0';
19
19
 
20
20
  /*!
21
21
  * Assertion Error
@@ -503,7 +503,7 @@ module.exports = function (chai, _) {
503
503
  for (var k in val) subset[k] = obj[k];
504
504
  expected = _.eql(subset, val);
505
505
  } else {
506
- expected = obj && ~obj.indexOf(val);
506
+ expected = (obj != undefined) && ~obj.indexOf(val);
507
507
  }
508
508
  this.assert(
509
509
  expected
@@ -620,6 +620,25 @@ module.exports = function (chai, _) {
620
620
  );
621
621
  });
622
622
 
623
+ /**
624
+ * ### .NaN
625
+ * Asserts that the target is `NaN`.
626
+ *
627
+ * expect('foo').to.be.NaN;
628
+ * expect(4).not.to.be.NaN;
629
+ *
630
+ * @name NaN
631
+ * @api public
632
+ */
633
+
634
+ Assertion.addProperty('NaN', function () {
635
+ this.assert(
636
+ isNaN(flag(this, 'object'))
637
+ , 'expected #{this} to be NaN'
638
+ , 'expected #{this} not to be NaN'
639
+ );
640
+ });
641
+
623
642
  /**
624
643
  * ### .exist
625
644
  *
@@ -662,17 +681,8 @@ module.exports = function (chai, _) {
662
681
  */
663
682
 
664
683
  Assertion.addProperty('empty', function () {
665
- var obj = flag(this, 'object')
666
- , expected = obj;
667
-
668
- if (Array.isArray(obj) || 'string' === typeof object) {
669
- expected = obj.length;
670
- } else if (typeof obj === 'object') {
671
- expected = Object.keys(obj).length;
672
- }
673
-
674
684
  this.assert(
675
- !expected
685
+ Object.keys(Object(flag(this, 'object'))).length === 0
676
686
  , 'expected #{this} to be empty'
677
687
  , 'expected #{this} not to be empty'
678
688
  );
@@ -1638,12 +1648,13 @@ module.exports = function (chai, _) {
1638
1648
  * expect(Klass).itself.to.respondTo('baz');
1639
1649
  *
1640
1650
  * @name respondTo
1651
+ * @alias respondsTo
1641
1652
  * @param {String} method
1642
1653
  * @param {String} message _optional_
1643
1654
  * @api public
1644
1655
  */
1645
1656
 
1646
- Assertion.addMethod('respondTo', function (method, msg) {
1657
+ function respondTo (method, msg) {
1647
1658
  if (msg) flag(this, 'message', msg);
1648
1659
  var obj = flag(this, 'object')
1649
1660
  , itself = flag(this, 'itself')
@@ -1656,7 +1667,10 @@ module.exports = function (chai, _) {
1656
1667
  , 'expected #{this} to respond to ' + _.inspect(method)
1657
1668
  , 'expected #{this} to not respond to ' + _.inspect(method)
1658
1669
  );
1659
- });
1670
+ }
1671
+
1672
+ Assertion.addMethod('respondTo', respondTo);
1673
+ Assertion.addMethod('respondsTo', respondTo);
1660
1674
 
1661
1675
  /**
1662
1676
  * ### .itself
@@ -1686,12 +1700,13 @@ module.exports = function (chai, _) {
1686
1700
  * expect(1).to.satisfy(function(num) { return num > 0; });
1687
1701
  *
1688
1702
  * @name satisfy
1703
+ * @alias satisfies
1689
1704
  * @param {Function} matcher
1690
1705
  * @param {String} message _optional_
1691
1706
  * @api public
1692
1707
  */
1693
1708
 
1694
- Assertion.addMethod('satisfy', function (matcher, msg) {
1709
+ function satisfy (matcher, msg) {
1695
1710
  if (msg) flag(this, 'message', msg);
1696
1711
  var obj = flag(this, 'object');
1697
1712
  var result = matcher(obj);
@@ -1702,7 +1717,10 @@ module.exports = function (chai, _) {
1702
1717
  , this.negate ? false : true
1703
1718
  , result
1704
1719
  );
1705
- });
1720
+ }
1721
+
1722
+ Assertion.addMethod('satisfy', satisfy);
1723
+ Assertion.addMethod('satisfies', satisfy);
1706
1724
 
1707
1725
  /**
1708
1726
  * ### .closeTo(expected, delta)
@@ -1907,6 +1925,128 @@ module.exports = function (chai, _) {
1907
1925
  Assertion.addChainableMethod('decrease', assertDecreases);
1908
1926
  Assertion.addChainableMethod('decreases', assertDecreases);
1909
1927
 
1928
+ /**
1929
+ * ### .extensible
1930
+ *
1931
+ * Asserts that the target is extensible (can have new properties added to
1932
+ * it).
1933
+ *
1934
+ * var nonExtensibleObject = Object.preventExtensions({});
1935
+ * var sealedObject = Object.seal({});
1936
+ * var frozenObject = Object.freeze({});
1937
+ *
1938
+ * expect({}).to.be.extensible;
1939
+ * expect(nonExtensibleObject).to.not.be.extensible;
1940
+ * expect(sealedObject).to.not.be.extensible;
1941
+ * expect(frozenObject).to.not.be.extensible;
1942
+ *
1943
+ * @name extensible
1944
+ * @api public
1945
+ */
1946
+
1947
+ Assertion.addProperty('extensible', function() {
1948
+ var obj = flag(this, 'object');
1949
+
1950
+ // In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
1951
+ // In ES6, a non-object argument will be treated as if it was a non-extensible ordinary object, simply return false.
1952
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible
1953
+ // The following provides ES6 behavior when a TypeError is thrown under ES5.
1954
+
1955
+ var isExtensible;
1956
+
1957
+ try {
1958
+ isExtensible = Object.isExtensible(obj);
1959
+ } catch (err) {
1960
+ if (err instanceof TypeError) isExtensible = false;
1961
+ else throw err;
1962
+ }
1963
+
1964
+ this.assert(
1965
+ isExtensible
1966
+ , 'expected #{this} to be extensible'
1967
+ , 'expected #{this} to not be extensible'
1968
+ );
1969
+ });
1970
+
1971
+ /**
1972
+ * ### .sealed
1973
+ *
1974
+ * Asserts that the target is sealed (cannot have new properties added to it
1975
+ * and its existing properties cannot be removed).
1976
+ *
1977
+ * var sealedObject = Object.seal({});
1978
+ * var frozenObject = Object.freeze({});
1979
+ *
1980
+ * expect(sealedObject).to.be.sealed;
1981
+ * expect(frozenObject).to.be.sealed;
1982
+ * expect({}).to.not.be.sealed;
1983
+ *
1984
+ * @name sealed
1985
+ * @api public
1986
+ */
1987
+
1988
+ Assertion.addProperty('sealed', function() {
1989
+ var obj = flag(this, 'object');
1990
+
1991
+ // In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
1992
+ // In ES6, a non-object argument will be treated as if it was a sealed ordinary object, simply return true.
1993
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isSealed
1994
+ // The following provides ES6 behavior when a TypeError is thrown under ES5.
1995
+
1996
+ var isSealed;
1997
+
1998
+ try {
1999
+ isSealed = Object.isSealed(obj);
2000
+ } catch (err) {
2001
+ if (err instanceof TypeError) isSealed = true;
2002
+ else throw err;
2003
+ }
2004
+
2005
+ this.assert(
2006
+ isSealed
2007
+ , 'expected #{this} to be sealed'
2008
+ , 'expected #{this} to not be sealed'
2009
+ );
2010
+ });
2011
+
2012
+ /**
2013
+ * ### .frozen
2014
+ *
2015
+ * Asserts that the target is frozen (cannot have new properties added to it
2016
+ * and its existing properties cannot be modified).
2017
+ *
2018
+ * var frozenObject = Object.freeze({});
2019
+ *
2020
+ * expect(frozenObject).to.be.frozen;
2021
+ * expect({}).to.not.be.frozen;
2022
+ *
2023
+ * @name frozen
2024
+ * @api public
2025
+ */
2026
+
2027
+ Assertion.addProperty('frozen', function() {
2028
+ var obj = flag(this, 'object');
2029
+
2030
+ // In ES5, if the argument to this method is not an object (a primitive), then it will cause a TypeError.
2031
+ // In ES6, a non-object argument will be treated as if it was a frozen ordinary object, simply return true.
2032
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isFrozen
2033
+ // The following provides ES6 behavior when a TypeError is thrown under ES5.
2034
+
2035
+ var isFrozen;
2036
+
2037
+ try {
2038
+ isFrozen = Object.isFrozen(obj);
2039
+ } catch (err) {
2040
+ if (err instanceof TypeError) isFrozen = true;
2041
+ else throw err;
2042
+ }
2043
+
2044
+ this.assert(
2045
+ isFrozen
2046
+ , 'expected #{this} to be frozen'
2047
+ , 'expected #{this} to not be frozen'
2048
+ );
2049
+ });
1910
2050
  };
1911
2051
 
1912
2052
  },{}],6:[function(require,module,exports){
@@ -1976,38 +2116,40 @@ module.exports = function (chai, util) {
1976
2116
  };
1977
2117
 
1978
2118
  /**
1979
- * ### .ok(object, [message])
2119
+ * ### .isOk(object, [message])
1980
2120
  *
1981
2121
  * Asserts that `object` is truthy.
1982
2122
  *
1983
- * assert.ok('everything', 'everything is ok');
1984
- * assert.ok(false, 'this will fail');
2123
+ * assert.isOk('everything', 'everything is ok');
2124
+ * assert.isOk(false, 'this will fail');
1985
2125
  *
1986
- * @name ok
2126
+ * @name isOk
2127
+ * @alias ok
1987
2128
  * @param {Mixed} object to test
1988
2129
  * @param {String} message
1989
2130
  * @api public
1990
2131
  */
1991
2132
 
1992
- assert.ok = function (val, msg) {
2133
+ assert.isOk = function (val, msg) {
1993
2134
  new Assertion(val, msg).is.ok;
1994
2135
  };
1995
2136
 
1996
2137
  /**
1997
- * ### .notOk(object, [message])
2138
+ * ### .isNotOk(object, [message])
1998
2139
  *
1999
2140
  * Asserts that `object` is falsy.
2000
2141
  *
2001
- * assert.notOk('everything', 'this will fail');
2002
- * assert.notOk(false, 'this will pass');
2142
+ * assert.isNotOk('everything', 'this will fail');
2143
+ * assert.isNotOk(false, 'this will pass');
2003
2144
  *
2004
- * @name notOk
2145
+ * @name isNotOk
2146
+ * @alias notOk
2005
2147
  * @param {Mixed} object to test
2006
2148
  * @param {String} message
2007
2149
  * @api public
2008
2150
  */
2009
2151
 
2010
- assert.notOk = function (val, msg) {
2152
+ assert.isNotOk = function (val, msg) {
2011
2153
  new Assertion(val, msg).is.not.ok;
2012
2154
  };
2013
2155
 
@@ -2135,16 +2277,16 @@ module.exports = function (chai, util) {
2135
2277
  new Assertion(act, msg).to.not.eql(exp);
2136
2278
  };
2137
2279
 
2138
- /**
2139
- * ### .isTrue(value, [message])
2280
+ /**
2281
+ * ### .isAbove(valueToCheck, valueToBeAbove, [message])
2140
2282
  *
2141
- * Asserts that `value` is true.
2283
+ * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`
2142
2284
  *
2143
- * var teaServed = true;
2144
- * assert.isTrue(teaServed, 'the tea has been served');
2285
+ * assert.isAbove(5, 2, '5 is strictly greater than 2');
2145
2286
  *
2146
- * @name isTrue
2147
- * @param {Mixed} value
2287
+ * @name isAbove
2288
+ * @param {Mixed} valueToCheck
2289
+ * @param {Mixed} valueToBeAbove
2148
2290
  * @param {String} message
2149
2291
  * @api public
2150
2292
  */
@@ -2154,21 +2296,22 @@ module.exports = function (chai, util) {
2154
2296
  };
2155
2297
 
2156
2298
  /**
2157
- * ### .isAbove(valueToCheck, valueToBeAbove, [message])
2299
+ * ### .isAtLeast(valueToCheck, valueToBeAtLeast, [message])
2158
2300
  *
2159
- * Asserts `valueToCheck` is strictly greater than (>) `valueToBeAbove`
2301
+ * Asserts `valueToCheck` is greater than or equal to (>=) `valueToBeAtLeast`
2160
2302
  *
2161
- * assert.isAbove(5, 2, '5 is strictly greater than 2');
2303
+ * assert.isAtLeast(5, 2, '5 is greater or equal to 2');
2304
+ * assert.isAtLeast(3, 3, '3 is greater or equal to 3');
2162
2305
  *
2163
- * @name isAbove
2306
+ * @name isAtLeast
2164
2307
  * @param {Mixed} valueToCheck
2165
- * @param {Mixed} valueToBeAbove
2308
+ * @param {Mixed} valueToBeAtLeast
2166
2309
  * @param {String} message
2167
2310
  * @api public
2168
2311
  */
2169
2312
 
2170
- assert.isBelow = function (val, blw, msg) {
2171
- new Assertion(val, msg).to.be.below(blw);
2313
+ assert.isAtLeast = function (val, atlst, msg) {
2314
+ new Assertion(val, msg).to.be.least(atlst);
2172
2315
  };
2173
2316
 
2174
2317
  /**
@@ -2185,10 +2328,65 @@ module.exports = function (chai, util) {
2185
2328
  * @api public
2186
2329
  */
2187
2330
 
2331
+ assert.isBelow = function (val, blw, msg) {
2332
+ new Assertion(val, msg).to.be.below(blw);
2333
+ };
2334
+
2335
+ /**
2336
+ * ### .isAtMost(valueToCheck, valueToBeAtMost, [message])
2337
+ *
2338
+ * Asserts `valueToCheck` is less than or equal to (<=) `valueToBeAtMost`
2339
+ *
2340
+ * assert.isAtMost(3, 6, '3 is less than or equal to 6');
2341
+ * assert.isAtMost(4, 4, '4 is less than or equal to 4');
2342
+ *
2343
+ * @name isAtMost
2344
+ * @param {Mixed} valueToCheck
2345
+ * @param {Mixed} valueToBeAtMost
2346
+ * @param {String} message
2347
+ * @api public
2348
+ */
2349
+
2350
+ assert.isAtMost = function (val, atmst, msg) {
2351
+ new Assertion(val, msg).to.be.most(atmst);
2352
+ };
2353
+
2354
+ /**
2355
+ * ### .isTrue(value, [message])
2356
+ *
2357
+ * Asserts that `value` is true.
2358
+ *
2359
+ * var teaServed = true;
2360
+ * assert.isTrue(teaServed, 'the tea has been served');
2361
+ *
2362
+ * @name isTrue
2363
+ * @param {Mixed} value
2364
+ * @param {String} message
2365
+ * @api public
2366
+ */
2367
+
2188
2368
  assert.isTrue = function (val, msg) {
2189
2369
  new Assertion(val, msg).is['true'];
2190
2370
  };
2191
2371
 
2372
+ /**
2373
+ * ### .isNotTrue(value, [message])
2374
+ *
2375
+ * Asserts that `value` is not true.
2376
+ *
2377
+ * var tea = 'tasty chai';
2378
+ * assert.isNotTrue(tea, 'great, time for tea!');
2379
+ *
2380
+ * @name isNotTrue
2381
+ * @param {Mixed} value
2382
+ * @param {String} message
2383
+ * @api public
2384
+ */
2385
+
2386
+ assert.isNotTrue = function (val, msg) {
2387
+ new Assertion(val, msg).to.not.equal(true);
2388
+ };
2389
+
2192
2390
  /**
2193
2391
  * ### .isFalse(value, [message])
2194
2392
  *
@@ -2207,6 +2405,24 @@ module.exports = function (chai, util) {
2207
2405
  new Assertion(val, msg).is['false'];
2208
2406
  };
2209
2407
 
2408
+ /**
2409
+ * ### .isNotFalse(value, [message])
2410
+ *
2411
+ * Asserts that `value` is not false.
2412
+ *
2413
+ * var tea = 'tasty chai';
2414
+ * assert.isNotFalse(tea, 'great, time for tea!');
2415
+ *
2416
+ * @name isNotFalse
2417
+ * @param {Mixed} value
2418
+ * @param {String} message
2419
+ * @api public
2420
+ */
2421
+
2422
+ assert.isNotFalse = function (val, msg) {
2423
+ new Assertion(val, msg).to.not.equal(false);
2424
+ };
2425
+
2210
2426
  /**
2211
2427
  * ### .isNull(value, [message])
2212
2428
  *
@@ -2242,6 +2458,37 @@ module.exports = function (chai, util) {
2242
2458
  new Assertion(val, msg).to.not.equal(null);
2243
2459
  };
2244
2460
 
2461
+ /**
2462
+ * ### .isNaN
2463
+ * Asserts that value is NaN
2464
+ *
2465
+ * assert.isNaN('foo', 'foo is NaN');
2466
+ *
2467
+ * @name isNaN
2468
+ * @param {Mixed} value
2469
+ * @param {String} message
2470
+ * @api public
2471
+ */
2472
+
2473
+ assert.isNaN = function (val, msg) {
2474
+ new Assertion(val, msg).to.be.NaN;
2475
+ };
2476
+
2477
+ /**
2478
+ * ### .isNotNaN
2479
+ * Asserts that value is not NaN
2480
+ *
2481
+ * assert.isNotNaN(4, '4 is not NaN');
2482
+ *
2483
+ * @name isNotNaN
2484
+ * @param {Mixed} value
2485
+ * @param {String} message
2486
+ * @api public
2487
+ */
2488
+ assert.isNotNaN = function (val, msg) {
2489
+ new Assertion(val, msg).not.to.be.NaN;
2490
+ };
2491
+
2245
2492
  /**
2246
2493
  * ### .isUndefined(value, [message])
2247
2494
  *
@@ -2845,11 +3092,11 @@ module.exports = function (chai, util) {
2845
3092
  * `constructor`, or alternately that it will throw an error with message
2846
3093
  * matching `regexp`.
2847
3094
  *
2848
- * assert.throw(fn, 'function throws a reference error');
2849
- * assert.throw(fn, /function throws a reference error/);
2850
- * assert.throw(fn, ReferenceError);
2851
- * assert.throw(fn, ReferenceError, 'function throws a reference error');
2852
- * assert.throw(fn, ReferenceError, /function throws a reference error/);
3095
+ * assert.throws(fn, 'function throws a reference error');
3096
+ * assert.throws(fn, /function throws a reference error/);
3097
+ * assert.throws(fn, ReferenceError);
3098
+ * assert.throws(fn, ReferenceError, 'function throws a reference error');
3099
+ * assert.throws(fn, ReferenceError, /function throws a reference error/);
2853
3100
  *
2854
3101
  * @name throws
2855
3102
  * @alias throw
@@ -2862,13 +3109,13 @@ module.exports = function (chai, util) {
2862
3109
  * @api public
2863
3110
  */
2864
3111
 
2865
- assert.Throw = function (fn, errt, errs, msg) {
3112
+ assert.throws = function (fn, errt, errs, msg) {
2866
3113
  if ('string' === typeof errt || errt instanceof RegExp) {
2867
3114
  errs = errt;
2868
3115
  errt = null;
2869
3116
  }
2870
3117
 
2871
- var assertErr = new Assertion(fn, msg).to.Throw(errt, errs);
3118
+ var assertErr = new Assertion(fn, msg).to.throw(errt, errs);
2872
3119
  return flag(assertErr, 'object');
2873
3120
  };
2874
3121
 
@@ -3158,7 +3405,7 @@ module.exports = function (chai, util) {
3158
3405
  * ### .ifError(object)
3159
3406
  *
3160
3407
  * Asserts if value is not a false value, and throws if it is a true value.
3161
- * This is added to allow for chai to be a drop-in replacement for Node's
3408
+ * This is added to allow for chai to be a drop-in replacement for Node's
3162
3409
  * assert class.
3163
3410
  *
3164
3411
  * var err = new Error('I am a custom error');
@@ -3175,6 +3422,127 @@ module.exports = function (chai, util) {
3175
3422
  }
3176
3423
  };
3177
3424
 
3425
+ /**
3426
+ * ### .isExtensible(object)
3427
+ *
3428
+ * Asserts that `object` is extensible (can have new properties added to it).
3429
+ *
3430
+ * assert.isExtensible({});
3431
+ *
3432
+ * @name isExtensible
3433
+ * @alias extensible
3434
+ * @param {Object} object
3435
+ * @param {String} message _optional_
3436
+ * @api public
3437
+ */
3438
+
3439
+ assert.isExtensible = function (obj, msg) {
3440
+ new Assertion(obj, msg).to.be.extensible;
3441
+ };
3442
+
3443
+ /**
3444
+ * ### .isNotExtensible(object)
3445
+ *
3446
+ * Asserts that `object` is _not_ extensible.
3447
+ *
3448
+ * var nonExtensibleObject = Object.preventExtensions({});
3449
+ * var sealedObject = Object.seal({});
3450
+ * var frozenObject = Object.freese({});
3451
+ *
3452
+ * assert.isNotExtensible(nonExtensibleObject);
3453
+ * assert.isNotExtensible(sealedObject);
3454
+ * assert.isNotExtensible(frozenObject);
3455
+ *
3456
+ * @name isNotExtensible
3457
+ * @alias notExtensible
3458
+ * @param {Object} object
3459
+ * @param {String} message _optional_
3460
+ * @api public
3461
+ */
3462
+
3463
+ assert.isNotExtensible = function (obj, msg) {
3464
+ new Assertion(obj, msg).to.not.be.extensible;
3465
+ };
3466
+
3467
+ /**
3468
+ * ### .isSealed(object)
3469
+ *
3470
+ * Asserts that `object` is sealed (cannot have new properties added to it
3471
+ * and its existing properties cannot be removed).
3472
+ *
3473
+ * var sealedObject = Object.seal({});
3474
+ * var frozenObject = Object.seal({});
3475
+ *
3476
+ * assert.isSealed(sealedObject);
3477
+ * assert.isSealed(frozenObject);
3478
+ *
3479
+ * @name isSealed
3480
+ * @alias sealed
3481
+ * @param {Object} object
3482
+ * @param {String} message _optional_
3483
+ * @api public
3484
+ */
3485
+
3486
+ assert.isSealed = function (obj, msg) {
3487
+ new Assertion(obj, msg).to.be.sealed;
3488
+ };
3489
+
3490
+ /**
3491
+ * ### .isNotSealed(object)
3492
+ *
3493
+ * Asserts that `object` is _not_ sealed.
3494
+ *
3495
+ * assert.isNotSealed({});
3496
+ *
3497
+ * @name isNotSealed
3498
+ * @alias notSealed
3499
+ * @param {Object} object
3500
+ * @param {String} message _optional_
3501
+ * @api public
3502
+ */
3503
+
3504
+ assert.isNotSealed = function (obj, msg) {
3505
+ new Assertion(obj, msg).to.not.be.sealed;
3506
+ };
3507
+
3508
+ /**
3509
+ * ### .isFrozen(object)
3510
+ *
3511
+ * Asserts that `object` is frozen (cannot have new properties added to it
3512
+ * and its existing properties cannot be modified).
3513
+ *
3514
+ * var frozenObject = Object.freeze({});
3515
+ * assert.frozen(frozenObject);
3516
+ *
3517
+ * @name isFrozen
3518
+ * @alias frozen
3519
+ * @param {Object} object
3520
+ * @param {String} message _optional_
3521
+ * @api public
3522
+ */
3523
+
3524
+ assert.isFrozen = function (obj, msg) {
3525
+ new Assertion(obj, msg).to.be.frozen;
3526
+ };
3527
+
3528
+ /**
3529
+ * ### .isNotFrozen(object)
3530
+ *
3531
+ * Asserts that `object` is _not_ frozen.
3532
+ *
3533
+ * assert.isNotFrozen({});
3534
+ *
3535
+ * @name isNotFrozen
3536
+ * @alias notFrozen
3537
+ * @param {Object} object
3538
+ * @param {String} message _optional_
3539
+ * @api public
3540
+ */
3541
+
3542
+ assert.isNotFrozen = function (obj, msg) {
3543
+ new Assertion(obj, msg).to.not.be.frozen;
3544
+ };
3545
+
3178
3546
  /*!
3179
3547
  * Aliases.
3180
3548
  */
@@ -3183,8 +3551,16 @@ module.exports = function (chai, util) {
3183
3551
  assert[as] = assert[name];
3184
3552
  return alias;
3185
3553
  })
3186
- ('Throw', 'throw')
3187
- ('Throw', 'throws');
3554
+ ('isOk', 'ok')
3555
+ ('isNotOk', 'notOk')
3556
+ ('throws', 'throw')
3557
+ ('throws', 'Throw')
3558
+ ('isExtensible', 'extensible')
3559
+ ('isNotExtensible', 'notExtensible')
3560
+ ('isSealed', 'sealed')
3561
+ ('isNotSealed', 'notSealed')
3562
+ ('isFrozen', 'frozen')
3563
+ ('isNotFrozen', 'notFrozen');
3188
3564
  };
3189
3565
 
3190
3566
  },{}],7:[function(require,module,exports){
@@ -3487,6 +3863,9 @@ module.exports = function (ctx, name, method) {
3487
3863
  * MIT Licensed
3488
3864
  */
3489
3865
 
3866
+ var config = require('../config');
3867
+ var flag = require('./flag');
3868
+
3490
3869
  /**
3491
3870
  * ### addProperty (ctx, name, getter)
3492
3871
  *
@@ -3514,7 +3893,11 @@ module.exports = function (ctx, name, method) {
3514
3893
 
3515
3894
  module.exports = function (ctx, name, getter) {
3516
3895
  Object.defineProperty(ctx, name,
3517
- { get: function () {
3896
+ { get: function addProperty() {
3897
+ var old_ssfi = flag(this, 'ssfi');
3898
+ if (old_ssfi && config.includeStack === false)
3899
+ flag(this, 'ssfi', addProperty);
3900
+
3518
3901
  var result = getter.call(this);
3519
3902
  return result === undefined ? this : result;
3520
3903
  }
@@ -3522,7 +3905,7 @@ module.exports = function (ctx, name, getter) {
3522
3905
  });
3523
3906
  };
3524
3907
 
3525
- },{}],12:[function(require,module,exports){
3908
+ },{"../config":4,"./flag":12}],12:[function(require,module,exports){
3526
3909
  /*!
3527
3910
  * Chai - flag utility
3528
3911
  * Copyright(c) 2012-2014 Jake Luer <jake@alogicalparadox.com>
@@ -3853,7 +4236,7 @@ module.exports = function(path, obj) {
3853
4236
  */
3854
4237
 
3855
4238
  module.exports = function getProperties(object) {
3856
- var result = Object.getOwnPropertyNames(subject);
4239
+ var result = Object.getOwnPropertyNames(object);
3857
4240
 
3858
4241
  function addProperty(property) {
3859
4242
  if (result.indexOf(property) === -1) {
@@ -3861,7 +4244,7 @@ module.exports = function getProperties(object) {
3861
4244
  }
3862
4245
  }
3863
4246
 
3864
- var proto = Object.getPrototypeOf(subject);
4247
+ var proto = Object.getPrototypeOf(object);
3865
4248
  while (proto !== null) {
3866
4249
  Object.getOwnPropertyNames(proto).forEach(addProperty);
3867
4250
  proto = Object.getPrototypeOf(proto);