model_stubbing in Rails 1.2.x

Posted by jacqui maher on April 18, 2008 at 03:58 PM

I really like technoweenie’s plugin model_stubbing. It’s a nice alternative to fixtures, and an even nicer way to create stubs in your tests and specs.

Unfortunately the StreetEasy codebase is still on Rails 1.2.x which caused compatibility problems with the plugin. Rails 2 refactored Fixtures and database statements a bit.

I had to modify the plugin to get it to work with older versions of Rails. I forked the project on github and post about it to help anyone who’d like to use the plugin but is not upgraded to Rails 2 yet.

github homepage: forked model_stubbing
public clone url: git@github.com:jacqui/model_stubbing.git

[edit] btw, simplelog was munging the href for the public clone url; it seems to like prepending http:// to links, so i just removed the anchor tags from it.

quick script to move your test::units to specs

Posted by jacqui maher on December 25, 2007 at 01:25 AM

this isn’t drop dead gorgeous or anything, but it worked ok for what i needed to do in the amount of time i felt like spending on it. i’d love to see how someone would make it better though, as usual.


and argh, i really need to spend some time on the css here. it’s hard to read code i post, and i apologize about that. lame!

download it: teststospecs.rb

view it




upping your test coverage: rspec 1.1 + test unit

Posted by jacqui maher on December 18, 2007 at 10:50 AM

I am going to be looking into RSpec 1.1 in the next couple of days. While we haven’t upgraded our application to run on Rails 2 yet, I am really interested in RSpec’s new integration with Test::Unit.

Right now, we have two rake tasks for ascertaining test coverage using rcov: rake spec:rcov and rake test:rcov. Since one runs our Test::Unit tests, and one runs our RSpec tests, the outcome is far from accurate.

My plan is to hopefully use RSpec’s new integration with Test::Unit to convert all our Test::Unit tests to RSpec - this was, after all, my Big Plan from the beginning. It’s just a lot of work and I dont have that much time. I think this will allow me to move them all into the spec directory and get the total test coverage much more accurately.

I’ll be posting my progress here.

In other news, I’m almost done with the initial version of my automated mock framework plugin - nelson. More on that later as well.