Created
February 24, 2012 01:41
-
-
Save dmcaulay/1896608 to your computer and use it in GitHub Desktop.
using jasmine: simple unit tests for a backbone index view
This file contains 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
describe "Comnspace.Views.Entries.Index", -> | |
entries = undefined | |
view = undefined | |
$el = undefined | |
beforeEach -> | |
entries = new Comnspace.Collections.Entries() | |
entries.reset [ | |
title: "Railscasts" | |
url: "www.railscasts.com" | |
, | |
title: "PeepCode" | |
url: "www.peepcode.com" | |
] | |
view = new Comnspace.Views.Entries.Index(collection: entries) | |
$el = $(view.render().el) | |
it "renders a collection of entries", -> | |
expect($el).toHaveText /Railscasts/ | |
expect($el).toHaveText /PeepCode/ | |
it "adds new entries when they're added to the collection", -> | |
entries.add new Comnspace.Models.Entry( | |
title: "thoughtbot backbone.js" | |
url: "https://workshops.thoughtbot.com/backbone-js-on-rails" | |
) | |
expect($el).toHaveText /thoughtbot backbone.js/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment