Use new addEqualityTester method to employ _.isEqual in specs

This commit is contained in:
Nathan Sobo
2013-02-02 17:58:39 -07:00
parent d144dd4efe
commit e25d83ccbc

View File

@@ -65,15 +65,15 @@ window.keymap.bindKeys '*', 'meta-w': 'close'
$(document).on 'close', -> window.close()
$('html,body').css('overflow', 'auto')
jasmine.getEnv().addEqualityTester(_.isEqual) # Use underscore's definition of equality for toEqual assertions
jasmine.getEnv().defaultTimeoutInterval = 1000
ensureNoPathSubscriptions = ->
watchedPaths = $native.getWatchedPaths()
$native.unwatchAllPaths()
if watchedPaths.length > 0
throw new Error("Leaking subscriptions for paths: " + watchedPaths.join(", "))
# Use underscore's definition of equality for toEqual assertions
jasmine.Env.prototype.equals_ = _.isEqual
emitObject = jasmine.StringPrettyPrinter.prototype.emitObject
jasmine.StringPrettyPrinter.prototype.emitObject = (obj) ->
if obj.inspect
@@ -85,8 +85,6 @@ jasmine.unspy = (object, methodName) ->
throw new Error("Not a spy") unless object[methodName].originalValue?
object[methodName] = object[methodName].originalValue
jasmine.getEnv().defaultTimeoutInterval = 1000
window.keyIdentifierForKey = (key) ->
if key.length > 1 # named key
key