Created
August 9, 2012 22:29
-
-
Save fivetanley/3308610 to your computer and use it in GitHub Desktop.
Sinon fun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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