Global Setup In RSpec or How To Add Logging For Specs

Published July 4th, 2008 in rspec, story runner.    No Comments.

Brian Morearty had an interesting post on how to add additional information to a rails testing log when using Test::Unit. The benefit of this is that you can quickly scan your log file when a test fails and see clues on why it failed. If you’re using RSpec you can add the same functionality all within the confines of the RSpec API for both specs (examples) and the story runner.

Global Setup for

Writing Macros in RSpec

Published June 8th, 2008 in Ruby, rspec.    13 Comments.

Thoughtbot put up a good post about creating “macro”s with Shoulda . Shoulda has some very nice built-in macros which help a lot in keeping tests DRY without sacrificing the documentation aspect of tests. (In fact I think these improve the readability of most tests because it removes some of the noise.) As Tammer Saleh said in the post these “macros” are nothing more than normal class methods, and so you


About

Ben spends all day at work writing Ruby and far too much of his free time doing the same. He earned his Bachelors and Master degrees in Computer Science from the University of Utah. Other than Ruby the areas of software engineering, programming languages, and machine learning usually keep him busy. In his real life he enjoys running and other outdoor activities.

Categories