recently i was giving RSpec[1] and Behaviour-Driven Development (hereforth BDD)[2] a look and found myself repeatedly writing the same code constructs. i quickly slapped together two snippets for the ruby bundle that seem to help out. the snippets could be made more spiffy perhaps by turning them into macros and make them act similar to the rails migration macros - but they still might be of some use in their initial form.
worth noting, if you install RSpec 0.7.* and follow along with the BDD tutorial[3], make sure change all of their: object.should_be_equal to: object.should_be == or else you will be checking for object equality rather than value equality (as mentioned in their upgrade notice[4]). i sure wish they would have updated their tutorial...
cheers, jean-pierre
[1] RSpec http://rspec.rubyforge.org/ [2] BDD http://behaviour-driven.org/ [3] RSpec tutorial http://rspec.rubyforge.org/tutorials/ [4] RSpec update notice http://rspec.rubyforge.org/upgrade.html