RSpec 1.0.0 Finally Here!

Written on 3:32:00 PM by S. Potter

Thanks to the RSpec team for finally delivering RSpec, which I have been excited about for quite some time. Having about 5 projects (2 pure Ruby, 3 Rails) using RSpec 0.8.2 and 2 other projects still on (0.7.5) I was a little worried about migrating to the new RSpec 1.0.0 compliant API, which is a fair bit different than some of what was allowed in 0.8.2 and prior. However, the RSpec developers in all their wisdom foresaw this problem and wrote spec_translate where you simply give it the from directory and to directory in that order on the command line. Now it doesn't do everything, so don't expect too much, but it will convert all the context, setup, specify and teardown blocks to describe, before, it and after blocks respectively with very little fanfare or effort required from us. The gotchas for those of us that ignored the Test::Unit Cheat Sheet on the website for recommended RSpec usage (I am going to own up to it, yes):

  1. .should.eql expected_value becomes .should eql(expected_value)
  2. .should.not... becomes .should not...
  3. .should.be expected_result becomes .should be(expected_result)
Let me know if you find different varieties of the above API differences.

If you enjoyed this post Subscribe to our feed

No Comment

Post a Comment