Skip to content

Instantly share code, notes, and snippets.

View asalant's full-sized avatar

Alon Salant asalant

  • Good Eggs
  • San Francisco
View GitHub Profile
generate("cucumber")
run("rm -rf features")
git(:clone => "git://gitorious.org/workshop-features/features.git")
inside("features") { run("rm -rf .git") }
run("echo log/ > .gitignore; echo 'db/*.sqlite3' >> .gitignore;")
inside("config") { run("echo 'default: --format pretty' > cucumber.yml") }
rake("db:migrate")
@asalant
asalant / spec_helper.coffee
Created October 17, 2011 22:37
Per-test run Jasmine setup and teardown
app = require '../../server'
Mongo = require '../../app/lib/mongo'
# Use Jasime reporter to implement once-per entire suite setup and teardown
getEnv().addReporter {
reportRunnerStarting: (runner) ->
app.listen 3001
reportRunnerResults: (runner) ->
Mongo.close()
app.close()
@asalant
asalant / tumblerGists.terse.js
Created October 19, 2011 00:47
Embed gist on Tumbler
//From https://gist.github.com/637764
$(function() {
var gistPrefix = 'http://gist.github.com/',
// Cache document.write so that it can be restored once all Gists have been
// embedded.
cachedWrite = document.write,
body = $('body'),
// Map each p.gist to an object that contains the paragraph to be replaced
// and the Gist's identifier.
gists = $('p.gist').map(function(n, p) {
@asalant
asalant / gist:1344338
Created November 7, 2011 06:40
start jasmine-node with debugging enabled
node --debug-brk node_modules/jasmine-node/lib/jasmine-node/cli.js \
specs/app.spec.js
@asalant
asalant / gist:1344341
Created November 7, 2011 06:45
start jasmine-node with debugging and coffeescript enabled
node --debug-brk node_modules/jasmine-node/lib/jasmine-node/cli.js \
--coffee specs/app.spec.coffee
@asalant
asalant / jasmine_runner.coffee
Created November 7, 2011 06:49
Run jasmine spec written in coffeescript for node
process.env.NODE_ENV = 'test' unless process.env.NODE_ENV?
sys = require "sys"
_ = require "underscore"
dir = "jasmine-node/lib/jasmine-node/"
filename = "jasmine-2.0.0.rc1"
# Copy 'it', 'describe',... to global
for key, value of require("#{dir}#{filename}")
@asalant
asalant / gist:1344357
Created November 7, 2011 06:57
Run spec with coffeescript
coffee spec/app.spec.coffee
@asalant
asalant / gist:1344358
Created November 7, 2011 06:58
Debug spec with coffeescript
coffee --nodejs --debug-brk spec/app.spec.coffee
@asalant
asalant / spec_helper.coffee
Created November 7, 2011 07:10
Require jasmine runner if jasmine has not already been loaded
process.env.NODE_ENV = 'test' unless process.env.NODE_ENV?
require './jasmine_runner' unless jasmine?
#...
@asalant
asalant / example1.coffee
Created November 26, 2011 03:49
Asynchronous jasmine-node example 1
describe 'User', ->
describe '#save()', ->
it 'should save without error', (done) ->
user = new User('Luna')
user.save (error) ->
expect(error).toBeNull()
done();