jasmine-headless-webkit-pre.../intro/03_jasmine.md

80 lines
1.2 KiB
Markdown
Raw Permalink Normal View History

2011-12-12 14:46:21 +00:00
!SLIDE
# Writing Jasmine Tests
!SLIDE
# RSpec?
!SLIDE
@@@ ruby
(2 + 2).should == 4
!SLIDE
# Jasmine!
!SLIDE
@@@ javascript
expect(2 + 2).toEqual(4)
!SLIDE
# RSpec?
@@@ ruby
describe "CatsView" do
before do
@cats = [ stub ]
end
it 'should show cats' do
render
rendered.should have_css('#cats li')
end
end
!SLIDE
# JavaScript?
@@@ javascript
describe("CatsView", function() {
var view;
beforeEach(function() {
view = new CatsView({collection: [ {} ]})
}):
it('should show cats', function() {
view.render()
expect($(view.el)).toContain('#cats li')
});
});
!SLIDE
# CoffeeScript?
@@@ coffeescript
describe "CatsView", ->
view = null
beforeEach ->
view = new CatsView(collection: [ {} ])
it 'should show cats', ->
view.render()
expect($(view.el)).toContain('#cats li')
!SLIDE
# Plenty of resources to learn Jasmine itself
2011-12-14 00:37:46 +00:00
!SLIDE
# pivotal.github.com/jasmine
2011-12-12 14:46:21 +00:00
!SLIDE
# tryjasmine.com
2011-12-14 00:37:46 +00:00
!SLIDE
# For Backbone and Sinon.js
## tinnedfruit.com/2011/03/03/testing-backbone-apps-with-jasmine-sinon.html
2011-12-12 14:46:21 +00:00
!SLIDE
# But once you know Jasmine...