Some examples to be run inside the node console.
// First class players
var fn = function () {
# Example usage: | |
# | |
# describe 'foo' -> | |
# runAsync() | |
# it 'tests things' -> | |
# expect(0 is 0).toBeTruthy() | |
# done() | |
# | |
_done = false | |
done = -> _done = true |
# Override Backbone.sync to be rails friendly | |
Backbone.sync = ((original) => (method, model, options) -> | |
options ?= {} | |
# Wrap model's attrs in a Rails friendly way by injecting it into options.data | |
if not options.data? and model? and (method is "create" or method is "update" or method is "delete") | |
unless model.modelName? | |
throw new Error "You must specify a modelName in a Rails friendly | |
underscore format for this model to be persisted" | |