Folks have been asking me to share a screencast of how I write Jasmine tests for a few years, so I recorded the session and am providing it online, completely unedited:
Now, a few brief notes on the presentation itself.
First, the sample code is hosted on Github at searls/refactor-to-backbone-example. The anonymous jQuery and the Backbone specs can be found on the
backbone-specs branches, respectively. The application is a Lineman app, and you can find out how to install and run it on Lineman's README.
The second half of the presentation is intended to serve as a contrast, because here it's spent characterizing code that's at least been broken up into small(er) units with a named, usable API. In what should shock no one, slightly simpler units lead to slightly simpler tests. This codebase could use even more refactoring, but that's beyond the scope of this discussion.
I used and described several libraries during the presentation, you can find them here:
- included with Lineman, testem