Академический Документы
Профессиональный Документы
Культура Документы
Sarah Mei
Pivotal Labs
@sarahmei
sarah@pivotallabs.com
1
v=I/''=='D,
,
Hi everybody
2
v/6/./! ',
( MEI Sarah ,
Im Sarah Mei.
.
3
= ' Mei Sarah ,''7='.: e' :'=,
']/'//,
7',
I dont speak Japanese very well, so
thanks in advance for your patience.
4
!/ e 'I D:.v=I/,
http://www.ickr.com/photos/sunrise/4064417/
5
San Francisco!/=,
Im American. `//,
http://www.ickr.com/photos/junewess/3756778580/
6
America'/,
Im a Ruby & Rails
developer.
Ruby`Railsv|(,
Image copyright 2006-2010 Yukihiro Matsumoto
7
Ruby D''\ ,
I work at
)",
''
8
Pivotal Labs ! :7 =,Pivotal Labs ' Pivotal Tracker I6 '
=,.:/: Pivotal Labs '\/ ' ``.^` .
I work at
)",
''
''/
8
Pivotal Labs ! :7 =,Pivotal Labs ' Pivotal Tracker I6 '
=,.:/: Pivotal Labs '\/ ' ``.^` .
v/],"!)
9
''D : D:. 67 D: 9 ,7/ ,,,
Feels Like Ruby
v/],"!)
9
''D : D:. 67 D: 9 ,7/ ,,,
Feels Like Ruby
Making JavaScript a
Real Language
v/],"!)
9
''D : D:. 67 D: 9 ,7/ ,,,
What I like about Ruby
10
I want to set the stage by talking about what I enjoy about Ruby. First and foremost, its the
language itself. I love the expressiveness and accessibility.
But as a working developer, what I appreciate the most is the ability to test-drive everything.
Between rspec, test::unit, cucumber, capybara, webrat, shoulda, steak....I can pick the most
appropriate test tools for each project.
What I like about Ruby
Philosophy:
@jasminebdd
41
Thats where Jasmine comes in. Jasmine is Pivotals open-source JavaScript testing
framework.
It lets you do rspec-style testing.
The philosophy of Jasmine is that JavaScript should be tested with JavaScript. There are gems
out there such as harmony that let you test JavaScript with Ruby, but that just adds another
layer of indirection. JavaScript should be a rst-class language in web applications.
Also, it is not dependent on the DOM, so it can be used to test other types of JavaScript, such
as for WebOS.
Jasmine
Philosophy:
Philosophy:
No DOM dependency
@jasminebdd
41
Thats where Jasmine comes in. Jasmine is Pivotals open-source JavaScript testing
framework.
It lets you do rspec-style testing.
The philosophy of Jasmine is that JavaScript should be tested with JavaScript. There are gems
out there such as harmony that let you test JavaScript with Ruby, but that just adds another
layer of indirection. JavaScript should be a rst-class language in web applications.
Also, it is not dependent on the DOM, so it can be used to test other types of JavaScript, such
as for WebOS.
gem install jasmine
42
43
When you install jasmine, it comes with a rake task that creates a javascripts directory under
spec.
44
I create a new le called project_form_spec.js. In this le I describe the behavior of the
functions in the RubyKaigi.ProjectForm class. Heres the spec for removeTask.
45
It starts with a describe, like rspec, and the describe contains an it block. Both the
describe and the it take a string describing the behavior youre expecting.
Jasmine comes with a small set of matchers - here you see expect().toEqual(). You can also
write custom matchers, as in rspec.
46
It comes with a little server built in, that starts on port 8888 by default, where you can run
your specs in a browser.
To re-run them, just reload the page.
Jasmine also comes with a continuous integration task that runs the specs in a browser and
uses selenium to determine whether they pass or fail. There are plug-ins that run your specs
headlessly.
Summary
Test-drive
47
http://www.ickr.com/photos/zachklein/54389823
48
http://www.ickr.com/photos/rappensuncle/248625025
49
Questions?
\|//,
@sarahmei
sarah@pivotallabs.com
@jasminebdd
http://www.ickr.com/photos/rappensuncle/248625025
50
'\.' ' ,