jspec 4.2.0 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +6 -0
- data/bin/jspec +1 -1
- data/jspec.gemspec +2 -2
- data/lib/jspec.js +20 -18
- metadata +3 -3
data/History.md
CHANGED
data/bin/jspec
CHANGED
data/jspec.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{jspec}
|
5
|
-
s.version = "4.2.
|
5
|
+
s.version = "4.2.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["TJ Holowaychuk"]
|
9
|
-
s.date = %q{2010-04-
|
9
|
+
s.date = %q{2010-04-15}
|
10
10
|
s.default_executable = %q{jspec}
|
11
11
|
s.description = %q{JavaScript BDD Testing Framework}
|
12
12
|
s.email = %q{tj@vision-media.ca}
|
data/lib/jspec.js
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
;(function(){
|
5
5
|
|
6
6
|
JSpec = {
|
7
|
-
version : '4.2.
|
7
|
+
version : '4.2.1',
|
8
8
|
assert : true,
|
9
9
|
cache : {},
|
10
10
|
suites : [],
|
@@ -260,14 +260,14 @@
|
|
260
260
|
},
|
261
261
|
|
262
262
|
ProxyAssertion : function(object, method, times, negate) {
|
263
|
-
var self = this
|
264
|
-
|
263
|
+
var self = this,
|
264
|
+
old = object[method]
|
265
265
|
|
266
266
|
// Proxy
|
267
267
|
|
268
268
|
object[method] = function(){
|
269
|
-
args = toArray(arguments)
|
270
|
-
|
269
|
+
var args = toArray(arguments),
|
270
|
+
result = old.apply(object, args)
|
271
271
|
self.calls.push({ args : args, result : result })
|
272
272
|
return result
|
273
273
|
}
|
@@ -960,6 +960,7 @@
|
|
960
960
|
*/
|
961
961
|
|
962
962
|
normalizeMatcherBody : function(body) {
|
963
|
+
var captures
|
963
964
|
switch (body.constructor) {
|
964
965
|
case String:
|
965
966
|
if (captures = body.match(/^alias (\w+)/)) return JSpec.matchers[last(captures)]
|
@@ -1151,7 +1152,7 @@
|
|
1151
1152
|
function assert(matcher, args, negate) {
|
1152
1153
|
var expected = toArray(args, 1)
|
1153
1154
|
matcher.negate = negate
|
1154
|
-
assertion = new JSpec.Assertion(matcher, actual, expected, negate)
|
1155
|
+
var assertion = new JSpec.Assertion(matcher, actual, expected, negate)
|
1155
1156
|
hook('beforeAssertion', assertion)
|
1156
1157
|
if (matcher.defer) assertion.run()
|
1157
1158
|
else JSpec.currentSpec.assertions.push(assertion.run().report()), hook('afterAssertion', assertion)
|
@@ -1269,6 +1270,7 @@
|
|
1269
1270
|
*/
|
1270
1271
|
|
1271
1272
|
destub : function(object, method) {
|
1273
|
+
var captures
|
1272
1274
|
if (method) {
|
1273
1275
|
if (object['__prototype__' + method])
|
1274
1276
|
delete object[method]
|
@@ -1786,7 +1788,7 @@
|
|
1786
1788
|
have_length_within : "actual.length >= expected[0] && actual.length <= last(expected)",
|
1787
1789
|
|
1788
1790
|
receive : { defer : true, match : function(actual, method, times) {
|
1789
|
-
proxy = new JSpec.ProxyAssertion(actual, method, times, this.negate)
|
1791
|
+
var proxy = new JSpec.ProxyAssertion(actual, method, times, this.negate)
|
1790
1792
|
JSpec.currentSpec.assertions.push(proxy)
|
1791
1793
|
return proxy
|
1792
1794
|
}},
|
@@ -1799,8 +1801,8 @@
|
|
1799
1801
|
},
|
1800
1802
|
|
1801
1803
|
include : function(actual) {
|
1802
|
-
for (state = true, i = 1; i < arguments.length; i++) {
|
1803
|
-
arg = arguments[i]
|
1804
|
+
for (var state = true, i = 1; i < arguments.length; i++) {
|
1805
|
+
var arg = arguments[i]
|
1804
1806
|
switch (actual.constructor) {
|
1805
1807
|
case String:
|
1806
1808
|
case Number:
|
@@ -1847,39 +1849,39 @@
|
|
1847
1849
|
case Function : return expected[i].name || 'Error'
|
1848
1850
|
}
|
1849
1851
|
}
|
1850
|
-
exception = message_for(1) + (expected[2] ? ' and ' + message_for(2) : '')
|
1852
|
+
var exception = message_for(1) + (expected[2] ? ' and ' + message_for(2) : '')
|
1851
1853
|
return 'expected ' + exception + (negate ? ' not ' : '' ) +
|
1852
1854
|
' to be thrown, but ' + (this.e ? 'got ' + puts(this.e) : 'nothing was')
|
1853
1855
|
}},
|
1854
1856
|
|
1855
1857
|
have : function(actual, length, property) {
|
1856
|
-
return actual[property].length == length
|
1858
|
+
return actual[property] == null ? false : actual[property].length == length
|
1857
1859
|
},
|
1858
1860
|
|
1859
1861
|
have_at_least : function(actual, length, property) {
|
1860
|
-
return actual[property].length >= length
|
1862
|
+
return actual[property] == null ? (length === 0) : actual[property].length >= length
|
1861
1863
|
},
|
1862
1864
|
|
1863
1865
|
have_at_most :function(actual, length, property) {
|
1864
|
-
return actual[property].length <= length
|
1866
|
+
return actual[property] == null || actual[property].length <= length
|
1865
1867
|
},
|
1866
1868
|
|
1867
1869
|
have_within : function(actual, range, property) {
|
1868
|
-
length = actual[property].length
|
1870
|
+
var length = actual[property] == undefined ? 0 : actual[property].length
|
1869
1871
|
return length >= range.shift() && length <= range.pop()
|
1870
1872
|
},
|
1871
1873
|
|
1872
1874
|
have_prop : function(actual, property, value) {
|
1873
|
-
return actual[property]
|
1875
|
+
return actual[property] === undefined ||
|
1874
1876
|
actual[property] instanceof Function ? false:
|
1875
|
-
value
|
1877
|
+
value === undefined ? true:
|
1876
1878
|
does(actual[property], 'eql', value)
|
1877
1879
|
},
|
1878
1880
|
|
1879
1881
|
have_property : function(actual, property, value) {
|
1880
|
-
return actual[property]
|
1882
|
+
return actual[property] === undefined ||
|
1881
1883
|
actual[property] instanceof Function ? false:
|
1882
|
-
value
|
1884
|
+
value === undefined ? true:
|
1883
1885
|
value === actual[property]
|
1884
1886
|
}
|
1885
1887
|
})
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 4
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 4.2.
|
8
|
+
- 1
|
9
|
+
version: 4.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- TJ Holowaychuk
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-15 00:00:00 -07:00
|
18
18
|
default_executable: jspec
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|