Posted
13 January 2009 @ 2am

Tagged
, , ,

Share and Enjoy
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Digg
  • Twitter
  • Reddit
  • MySpace
  • Technorati
  • StumbleUpon
  • Tumblr
  • Slashdot
  • email
  • Print

Sugary new rspec syntax

A new version of rspec was just released and I love this bit of syntactic sugar (taken right out of the blog post):

describe Person do
  describe "born 19 years ago" do
    subject { Person.new(:birthdate => 19.years.ago }
    it { should be_eligible_to_vote }
    it { should be_eligible_to_enlist }
    it { should_not be_eligible_to_drink }
  end
end

The best part is that its a serious improvement to a very common use-case.  Kudos for the positive changes.  This is great.


blog comments powered by Disqus
Protoload is great Setting up test:benchmark