Skip to content

Instantly share code, notes, and snippets.

@fivetanley
Created August 9, 2012 22:29
Show Gist options
  • Save fivetanley/3308610 to your computer and use it in GitHub Desktop.
Save fivetanley/3308610 to your computer and use it in GitHub Desktop.
Sinon fun
define( function( require ) {
var EntryListingView = require( 'views/EntryListingView' )
describe('EntryListingView', function() {
var entryListingView
, id = 'entry'
, description = 'oaiweiul'
, entry
, mock
, entryView
beforeEach(function() {
entry = new Backbone.Model()
mock = sinon.mock( entry ).expects( 'get' )
.withArgs( 'id' )
.returns( id )
entryView = new EntryListingView({ model: entry } )
entryView.render()
})
describe('rendering', function() {
it('should ask its model for information', function() {
expect( mock ).toHaveBeenCalledOnce()
})
it('should render the id', function() {
expect( entryView.$el.text() ).toMatch( id )
})
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment