Lone Star Ruby Conference
Chris Wanstrath
On Your Best Behavior: BDD in Ruby
BDD is a way of writing code by testing what the code should do rather than testing the code itself. Really, it’s just TDD done right. This talk will focus on the two big libraries which facilities this process, RSpec and test/spec, with a bias towards test/spec.
Learn different BDD techniques gleamed from the RSpec team, Rubinius, various Rails apps, and a variety of Ruby gems. Discuss custom, BDDish assertions to help tests read cleanly. Amaze passer-bys by writing specs in YAML then converting them to BDD scaffolds. Gaze in wonder at the power of using mocks and stubs within your tests by way of the Mocha gem. Bewilder friends by converting test/unit tests to BDD style.
Another key advantage BDD brings to the table is a clear design process: describing what your code should be doing can, and often does, help determine how the code should be implemented and organized. This will be illustrated in a step-by-step manner.
The goal here is not to talk down to those who don’t test or choose to test using a different framework, but rather to show how fun testing can be and how easy it is to integrate these scary, new styles into one’s existing toolset. Autotest, heckle, redgreen, and rcov integration will also be touched upon in our quest to to decouple implementation from behavior.
Bio
Chris Wanstrath is a consultant for Err Free during the day and an open source hacker by night, co-maintaining a running commentary of Ruby and Rails known as Err the Blog in the grey hours between the two. In a past life he was a developer for CNET Networks, helping to care for such illustrious web sites as GameSpot.com, TV.com, MP3.com, Chowhound.com, and Chow.com. Some of them were even in Rails. He lives in San Francisco and is a huge David Carradine fan.
Home