presentation fixes for rubynation
This commit is contained in:
parent
70c4264416
commit
713f81bc44
@ -52,13 +52,13 @@ end
|
|||||||
onmouseout="this.src='normal.gif'" />
|
onmouseout="this.src='normal.gif'" />
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE larger
|
!SLIDE
|
||||||
``` html
|
``` html
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function showMyCoolTitle(title, length) {
|
function showMyCoolTitle(title, length) {
|
||||||
if (length == null) { length = 0; }
|
if (length == null) { length = 0; }
|
||||||
|
|
||||||
if (length < title.length) {
|
if (length <= title.length) {
|
||||||
document.title = title.substr(0, length);
|
document.title = title.substr(0, length);
|
||||||
length++;
|
length++;
|
||||||
|
|
||||||
@ -66,7 +66,9 @@ function showMyCoolTitle(title, length) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.onload = function() { showMyCoolTitle("My cool website! Whoaaaaa!"); }
|
window.onload = function() {
|
||||||
|
showMyCoolTitle("My cool website! Whoaaaaa!");
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Follow along!
|
# Follow along!
|
||||||
|
|
||||||
!SLIDE
|
!SLIDE
|
||||||
# [johnbintz.github.com/tea-time](http://johnbintz.github.com/tea-time/)
|
## [johnbintz.github.com/tea-time](http://johnbintz.github.com/tea-time/)
|
||||||
|
|
||||||
!SLIDE
|
!SLIDE
|
||||||
# No need to install anything right now
|
# No need to install anything right now
|
||||||
|
@ -22,7 +22,7 @@ describe 'Cat', ->
|
|||||||
!SLIDE image-80-percent
|
!SLIDE image-80-percent
|
||||||
<img src="assets/cat-meow.jpg" />
|
<img src="assets/cat-meow.jpg" />
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
describe 'Cat', ->
|
describe 'Cat', ->
|
||||||
describe '#meow', ->
|
describe '#meow', ->
|
||||||
|
@ -33,7 +33,7 @@ class this.Cat
|
|||||||
meow: ->
|
meow: ->
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
``` javascript
|
``` javascript
|
||||||
// safety wrapper to prevent global pollution
|
// safety wrapper to prevent global pollution
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -15,10 +15,12 @@
|
|||||||
describe 'Cat', ->
|
describe 'Cat', ->
|
||||||
describe '#meow', ->
|
describe '#meow', ->
|
||||||
describe 'hungry', ->
|
describe 'hungry', ->
|
||||||
# Cat#meow expectation for when the cat is hungry
|
# Cat#meow expectation for when
|
||||||
|
# the cat is hungry
|
||||||
|
|
||||||
describe 'going to the vet', ->
|
describe 'going to the vet', ->
|
||||||
# Cat#meow expectation for when the cat knows it's vet time
|
# Cat#meow expectation for when
|
||||||
|
# the cat knows it's vet time
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE larger
|
!SLIDE larger
|
||||||
@ -28,14 +30,16 @@ describe 'Cat', ->
|
|||||||
describe 'hungry', ->
|
describe 'hungry', ->
|
||||||
it 'should be a mournful meow', ->
|
it 'should be a mournful meow', ->
|
||||||
cat = new Cat()
|
cat = new Cat()
|
||||||
cat.state = -> Cat.HUNGRY # ...just like cat.stubs(:state)
|
cat.state = -> Cat.HUNGRY
|
||||||
|
# ...just like cat.stubs(:state)
|
||||||
|
|
||||||
expect(cat.meow()).toEqual("meeeyaow")
|
expect(cat.meow()).toEqual("meeeyaow")
|
||||||
|
|
||||||
describe 'going to the vet', ->
|
describe 'going to the vet', ->
|
||||||
it 'should be an evil meow', ->
|
it 'should be an evil meow', ->
|
||||||
cat = new Cat()
|
cat = new Cat()
|
||||||
cat.state = -> Cat.VET_PSYCHIC # ...just like the one above
|
cat.state = -> Cat.VET_PSYCHIC
|
||||||
|
# ...just like the one above
|
||||||
|
|
||||||
expect(cat.meow()).toEqual("raowwww")
|
expect(cat.meow()).toEqual("raowwww")
|
||||||
```
|
```
|
||||||
@ -72,7 +76,7 @@ before do
|
|||||||
@instance_variable = "yes"
|
@instance_variable = "yes"
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should be in the same context as the before block" do
|
it "is in same context as before block" do
|
||||||
@instance_variable.should == "yes"
|
@instance_variable.should == "yes"
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
@ -5,7 +5,8 @@
|
|||||||
``` ruby
|
``` ruby
|
||||||
cat.meow.should == "meow"
|
cat.meow.should == "meow"
|
||||||
cat.should be_a_kind_of(Cat)
|
cat.should be_a_kind_of(Cat)
|
||||||
cat.should_not be_hungry #=> cat.hungry?.should == false
|
cat.should_not be_hungry
|
||||||
|
# => cat.hungry?.should == false
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE even-larger
|
||||||
|
@ -36,7 +36,7 @@ describe 'John', ->
|
|||||||
!SLIDE image-80-percent
|
!SLIDE image-80-percent
|
||||||
<img src="assets/beer-cat.jpg" />
|
<img src="assets/beer-cat.jpg" />
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
``` gherkin
|
``` gherkin
|
||||||
Feature: Cat Behaviors
|
Feature: Cat Behaviors
|
||||||
Scenario: Hungry cats meow a particular way
|
Scenario: Hungry cats meow a particular way
|
||||||
@ -64,7 +64,7 @@ class this.Cat
|
|||||||
Cat.HUNGRY
|
Cat.HUNGRY
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
describe 'Cat', ->
|
describe 'Cat', ->
|
||||||
describe '#meow', ->
|
describe '#meow', ->
|
||||||
@ -93,8 +93,9 @@ class this.Cat
|
|||||||
|
|
||||||
!SLIDE larger
|
!SLIDE larger
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
cat.foodLevel = 15 # do we care about food level in this test?
|
cat.foodLevel = 15
|
||||||
# all we care about is that the cat is hungry
|
# do we care about food level in this test?
|
||||||
|
# all we care about is that the cat is hungry
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE larger
|
!SLIDE larger
|
||||||
@ -104,8 +105,9 @@ describe 'Cat', ->
|
|||||||
describe 'hungry', ->
|
describe 'hungry', ->
|
||||||
it 'should be a mournful meow', ->
|
it 'should be a mournful meow', ->
|
||||||
cat = new Cat()
|
cat = new Cat()
|
||||||
cat.state = -> Cat.HUNGRY # <= we don't care how state works,
|
cat.state = -> Cat.HUNGRY
|
||||||
# we just want a hungry cat
|
# ^^^ we don't care how state works,
|
||||||
|
# we just want a hungry cat
|
||||||
|
|
||||||
expect(cat.meow()).toEqual("meeeyaow")
|
expect(cat.meow()).toEqual("meeeyaow")
|
||||||
```
|
```
|
||||||
@ -154,7 +156,7 @@ class this.Cat
|
|||||||
this.modifyForGround(speech)
|
this.modifyForGround(speech)
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE larger
|
!SLIDE
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
describe 'Cat#vocalProcessor', ->
|
describe 'Cat#vocalProcessor', ->
|
||||||
speech = "speech"
|
speech = "speech"
|
||||||
@ -185,23 +187,23 @@ spyOn(@cat, 'modifyForAirborne')
|
|||||||
!SLIDE
|
!SLIDE
|
||||||
# Two basic ways to make sure a spy is called
|
# Two basic ways to make sure a spy is called
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE
|
||||||
# `toHaveBeenCalledWith()`
|
## `toHaveBeenCalledWith(args...)`
|
||||||
## Called least once with the given parameters
|
### Called least once with the given parameters
|
||||||
|
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
expect(@cat.modifyForAirborne).toHaveBeenCalledWith(speech)
|
expect(@cat.modifyForAirborne).toHaveBeenCalledWith(speech)
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE
|
||||||
# `toHaveBeenCalled()`
|
## `toHaveBeenCalled()`
|
||||||
# Just called, no parameter check
|
### Just called, no parameter check
|
||||||
|
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
expect(@cat.modifyForAirborne).toHaveBeenCalled()
|
expect(@cat.modifyForAirborne).toHaveBeenCalled()
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
# Instance Mocks/Spies in JavaScript
|
# Instance Mocks/Spies in JavaScript
|
||||||
## Use `spyOn`/`toHaveBeenCalled` matchers
|
## Use `spyOn`/`toHaveBeenCalled` matchers
|
||||||
|
|
||||||
@ -218,7 +220,7 @@ expect(cat.state).toHaveBeenCalled()
|
|||||||
!SLIDE
|
!SLIDE
|
||||||
# `spyOn` works great with class-level stubs and mocks, too
|
# `spyOn` works great with class-level stubs and mocks, too
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
class this.Cat
|
class this.Cat
|
||||||
@generateFurColor: (base) ->
|
@generateFurColor: (base) ->
|
||||||
@ -229,13 +231,13 @@ class this.Cat
|
|||||||
follicle.regrow(Cat.generateFurColor(this.baseColor))
|
follicle.regrow(Cat.generateFurColor(this.baseColor))
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
Cat.generateFurColor = ->
|
Cat.generateFurColor = ->
|
||||||
"whoops i nuked this method for every other test"
|
"whoops i nuked this method for every other test"
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE larger
|
!SLIDE
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
describe 'Cat#regrowFur', ->
|
describe 'Cat#regrowFur', ->
|
||||||
color = 'color'
|
color = 'color'
|
||||||
@ -257,7 +259,7 @@ describe 'Cat#regrowFur', ->
|
|||||||
expect(@follicle.regrow).toHaveBeenCalledWith(color)
|
expect(@follicle.regrow).toHaveBeenCalledWith(color)
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
# Class Stubs in JavaScript
|
# Class Stubs in JavaScript
|
||||||
## Use `spyOn` to generate stubs so that the original code is replaced after the test
|
## Use `spyOn` to generate stubs so that the original code is replaced after the test
|
||||||
|
|
||||||
@ -327,7 +329,7 @@ describe 'Cat#fetch', ->
|
|||||||
!SLIDE
|
!SLIDE
|
||||||
# Sometimes you just need a big blob of unit tests
|
# Sometimes you just need a big blob of unit tests
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
# fast and focused!
|
# fast and focused!
|
||||||
|
|
||||||
@ -341,7 +343,7 @@ describe 'Cat#respondsTo', ->
|
|||||||
expect(@cat.respondsTo(request)).toBeTruthy()
|
expect(@cat.respondsTo(request)).toBeTruthy()
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
``` gherkin
|
``` gherkin
|
||||||
# slow and synergistic!
|
# slow and synergistic!
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Using it in your project
|
# Using it in your project
|
||||||
|
|
||||||
!SLIDE
|
!SLIDE
|
||||||
# [github.com/pivotal/jasmine-gem](http://github.com/pivotal/jasmine-gem)
|
## [github.com/pivotal/jasmine-gem](http://github.com/pivotal/jasmine-gem)
|
||||||
|
|
||||||
!SLIDE
|
!SLIDE
|
||||||
# Starts a Rack server for running Jasmine against your code
|
# Starts a Rack server for running Jasmine against your code
|
||||||
|
@ -7,13 +7,13 @@
|
|||||||
!SLIDE
|
!SLIDE
|
||||||
# Mocking and stubbing `$.fn` calls
|
# Mocking and stubbing `$.fn` calls
|
||||||
|
|
||||||
!SLIDE larger
|
!SLIDE
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
this.containerWaiter = ->
|
this.containerWaiter = ->
|
||||||
$('#container').addClass('wait').append('<div class="waiting" />')
|
$('#container').addClass('wait').append('<div class="waiting" />')
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
$.fn.makeWait = ->
|
$.fn.makeWait = ->
|
||||||
$(this).addClass('wait').append('<div class="waiting" />')
|
$(this).addClass('wait').append('<div class="waiting" />')
|
||||||
@ -29,7 +29,7 @@ this.containerWaiter = ->
|
|||||||
!SLIDE
|
!SLIDE
|
||||||
# `jquery-jasmine`
|
# `jquery-jasmine`
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
describe 'container', ->
|
describe 'container', ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
@ -148,38 +148,7 @@ _.mixin(CatLike)
|
|||||||
_.catify("john") # => "meow meow john"
|
_.catify("john") # => "meow meow john"
|
||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE larger
|
||||||
``` coffeescript
|
|
||||||
CatLike =
|
|
||||||
catify: (name) -> "meow meow #{name}"
|
|
||||||
|
|
||||||
class Cat
|
|
||||||
hiss: -> "hiss"
|
|
||||||
|
|
||||||
# like Ruby include, add code to instances
|
|
||||||
for method, code of CatLike
|
|
||||||
Cat.prototype[method] = code
|
|
||||||
|
|
||||||
cat = new Cat()
|
|
||||||
cat.catify("john") # => "meow meow #{name}"
|
|
||||||
```
|
|
||||||
|
|
||||||
!SLIDE even-larger
|
|
||||||
``` coffeescript
|
|
||||||
CatLike =
|
|
||||||
catify: (name) -> "meow meow #{name}"
|
|
||||||
|
|
||||||
class Cat
|
|
||||||
hiss: -> "hiss"
|
|
||||||
|
|
||||||
# like Ruby extend, add code to class
|
|
||||||
for method, code of CatLike
|
|
||||||
Cat[method] = code
|
|
||||||
|
|
||||||
Cat.catify("john") # => "meow meow john"
|
|
||||||
```
|
|
||||||
|
|
||||||
!SLIDE even-larger
|
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
describe '_.catify', ->
|
describe '_.catify', ->
|
||||||
it 'should catify', ->
|
it 'should catify', ->
|
||||||
@ -189,7 +158,7 @@ describe '_.catify', ->
|
|||||||
!SLIDE
|
!SLIDE
|
||||||
# Eliminate the Underscore.js dependency
|
# Eliminate the Underscore.js dependency
|
||||||
|
|
||||||
!SLIDE even-larger
|
!SLIDE
|
||||||
``` coffeescript
|
``` coffeescript
|
||||||
describe 'CatLike', ->
|
describe 'CatLike', ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
|
@ -35,10 +35,10 @@ runs()
|
|||||||
```
|
```
|
||||||
|
|
||||||
!SLIDE
|
!SLIDE
|
||||||
# [Jasmine documentation](http://pivotal.github.com/jasmine/)
|
## [Jasmine documentation](http://pivotal.github.com/jasmine/)
|
||||||
|
|
||||||
!SLIDE
|
!SLIDE
|
||||||
# [johnbintz.github.com/tea-time](http://johnbintz.github.com/tea-time/)
|
## [johnbintz.github.com/tea-time](http://johnbintz.github.com/tea-time/)
|
||||||
|
|
||||||
!SLIDE
|
!SLIDE
|
||||||
# Any questions?
|
# Any questions?
|
||||||
|
Loading…
Reference in New Issue
Block a user