My first session was entitled RSpec is great of what? and talked about a tool that helps you do “Behavior Driven Development”. The key difference between RSpec as a validation tool from other xUnit tools like JUnit or Test::Unit is that instead of using “Assert” style validations we use “Should” style validations. Here is a short example of pulling up a web page and verifying the words “Administer Bookshelf” show up.
$ie = $ie || Watir::IE.new $ie.goto ‘http://localhost:3000/login/login’ $ie.text.should include(‘Administer Bookshelf’)
Compare the last line to something in the older “Assert” style:
assert $ie.text.include?(‘Adminster Bookshelf’)
The should syntax reads much easier! And by removing the word “test” from your vocabulary you remove the Tester/Developer divide. “Should” is something you would define before writing the code. “Test” is something you do after you write the code!