lib/jspec.js in visionmedia-jspec-2.0.1 vs lib/jspec.js in visionmedia-jspec-2.0.2
- old
+ new
@@ -1,13 +1,13 @@
// JSpec - Core - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
(function(){
- var JSpec = {
+ JSpec = {
- version : '2.0.1',
+ version : '2.0.2',
suites : [],
allSuites : [],
matchers : {},
stats : { specs : 0, assertions : 0, failures : 0, passes : 0, specsFinished : 0, suitesFinished : 0 },
options : { profile : false },
@@ -136,34 +136,34 @@
* @api public
*/
Terminal : function(results, options) {
failuresOnly = option('failuresOnly')
- puts(color("\n Passes: ", 'bold') + color(results.stats.passes, 'green') +
+ print(color("\n Passes: ", 'bold') + color(results.stats.passes, 'green') +
color(" Failures: ", 'bold') + color(results.stats.failures, 'red') + "\n")
indent = function(string) {
return string.replace(/^(.)/gm, ' $1')
}
renderSuite = function(suite) {
displaySuite = failuresOnly ? suite.ran && !suite.passed() : suite.ran
if (displaySuite && suite.hasSpecs()) {
- puts(color(' ' + suite.description, 'bold'))
+ print(color(' ' + suite.description, 'bold'))
each(suite.specs, function(spec){
var assertionsGraph = inject(spec.assertions, '', function(graph, assertion){
return graph + color('.', assertion.passed ? 'green' : 'red')
})
if (spec.requiresImplementation())
- puts(color(' ' + spec.description, 'blue') + assertionsGraph)
+ print(color(' ' + spec.description, 'blue') + assertionsGraph)
else if (spec.passed() && !failuresOnly)
- puts(color(' ' + spec.description, 'green') + assertionsGraph)
+ print(color(' ' + spec.description, 'green') + assertionsGraph)
else if (!spec.passed())
- puts(color(' ' + spec.description, 'red') + assertionsGraph +
- "\n" + indent(spec.failure().message) + "\n")
+ print(color(' ' + spec.description, 'red') + assertionsGraph +
+ "\n" + indent(spec.failure().message) + "\n")
})
- puts('')
+ print("")
}
}
renderSuites = function(suites) {
each(suites, function(suite){
@@ -229,12 +229,12 @@
},
// Run the assertion
run : function() {
- // TODO: remove unshifting of expected
- expected.unshift(actual == null ? null : actual.valueOf())
+ // TODO: remove unshifting
+ expected.unshift(actual)
this.result = matcher.match.apply(this, expected)
this.passed = negate ? !this.result : this.result
if (!this.passed) this.message = matcher.message.call(this, actual, expected, negate, matcher.name)
return this
}
@@ -746,10 +746,11 @@
if (object.jquery) return escape(object.html())
if (object.nodeName) return escape(object.outerHTML)
switch (object.constructor) {
case String: return "'" + escape(object) + "'"
case Number: return object
+ case Function: return object.name || object
case Array :
return inject(object, '[', function(b, v){
return b + ', ' + puts(v)
}).replace('[,', '[') + ' ]'
case Object:
@@ -1334,11 +1335,11 @@
var inject = JSpec.inject
var select = JSpec.select
var error = JSpec.error
var escape = JSpec.escape
var extend = JSpec.extend
- var puts = JSpec.puts
+ var puts = JSpec.puts
var hash = JSpec.hash
var query = JSpec.query
var strip = JSpec.strip
var color = JSpec.color
var does = JSpec.does
@@ -1461,11 +1462,7 @@
actual[property] instanceof Function ? false:
value == null ? true:
value === actual[property]
}
})
-
- // --- Expose
-
- this.JSpec = JSpec
})()
\ No newline at end of file