a little rspec
TRANSCRIPT
![Page 1: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/1.jpg)
Jano GonzálezDeveloper
A Little RSpec
![Page 2: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/2.jpg)
code:https://github.com/janogonzalez/a-little-rspec
![Page 3: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/3.jpg)
From testing to describing code
![Page 4: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/4.jpg)
Describing Code
![Page 5: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/5.jpg)
Describing Code
![Page 6: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/6.jpg)
Describing Code
• describe: The thing to describe
• it: The expected behavior
• should/should_not: The assertion
![Page 7: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/7.jpg)
DRYing
![Page 8: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/8.jpg)
DRYing
![Page 9: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/9.jpg)
DRYing
• before: Preparing the test case
• after: Clean up
• around: Mix before & after
![Page 10: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/10.jpg)
A little more context
![Page 11: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/11.jpg)
A little more context
![Page 12: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/12.jpg)
A little more context
• context
![Page 13: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/13.jpg)
More DRYing
![Page 14: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/14.jpg)
More DRYing
![Page 15: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/15.jpg)
More DRYing
• let
• let!
![Page 16: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/16.jpg)
More DRYing
![Page 17: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/17.jpg)
More DRYing
• implicit subject
![Page 18: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/18.jpg)
More DRYing
![Page 19: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/19.jpg)
More DRYing
• implicit subject
• it
• its
![Page 20: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/20.jpg)
More DRYing
![Page 21: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/21.jpg)
More DRYing
• explicit subject
![Page 22: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/22.jpg)
More info
![Page 23: A Little RSpec](https://reader031.vdocuments.net/reader031/viewer/2022031918/55a268f11a28ab9f308b45d7/html5/thumbnails/23.jpg)
More info
• @dchelimsky
• The RSpec Book
• @janogonzalez ;)
• http://gemaroja.com ;)