-
Notifications
You must be signed in to change notification settings - Fork 0
Setting up Alfred with Teaspoon, Chai and SinonJS
Arjen Oosterkamp edited this page Apr 8, 2014
·
2 revisions
Please make sure you've setup Alfred using these instructions: https://github.com/jhnvz/alfred_rails/wiki/Setting-up-Alfred
This page describes setting up Alfred with Teaspoon, Chai and SinonJS. Alfred supports SinonJS serving a fake server with the recorded response. I assume you've set up Teaspoon.
# spec_helper.coffee
//=require support/sinon
//=require support/chai
//=require support/sinon-chai
//=require alfred
//=require alfred/sinon_adapter
//=require_tree ./../javascripts/fixtures
should = chai.should()# Example of a test
describe 'PostModel', ->
describe '#update', ->
it 'should update model', ->
# This is the magic. It creates a fakeServer and sets the response
@server = Alfred.SinonAdapter.serve('posts_controller/update', 'update post by manager')
@post.update()
@server.respond()
@post.updated().should.equal(true)