Shoulda and assert{2.0} make swell bedfellows

I have been generally using RSpec for my testing needs, but I've recently been persuaded to use Shoulda on a few projects.

For most things, they seem about on par.

One thing I missed in particular was the 'should' syntax of RSpec, like:

x.should == 42

As opposed to using test-unit's:

assertEqual 42, x

I haven't been able to entirely quantify why I prefer the former syntax, but I think it has to do with more succinctly expressing the assertion.

While I haven't found quite to replace that style syntax, I do have something that fits my craving: assert {2.0}. This gives us something like:

assert {x == 42}

I think I'm actually digging this over the other two styles, because:

  • If you can come up with an expression, you can assert it.
  • Nice output when the assertion fails.
April 06, 2008 at 18:29 Permalink Edit Destroy

The Big Rewrite is Here

When I first started this blog, it was my very first Rails project. I was young. I was naive. I didn't do automated testing.

Fast forward back to September, and I wanted to start adding some new features. I wanted to do it right though, with tests, and all. To my dismay, I found the way I had implemented things weren't so easy to test.

This, along with Rails 2.0 coming along, and some other new libraries/plugins I wanted to learn, led me to starting a complete rewrite.

So, here's a laundry list of what I've been using so far:

I think I'm mostly feature complete, but the most significant missing piece is...

Comments! I mostly need to find a good way of spam filtering. The original version was using simple_captcha, but I've been noticing spam has still been getting through. I'm considering trying akismet, which does have a few Rails plugins.

But yeah, that's it for now. I hope to pump out a few posts about this new stuff I'm using.

December 09, 2007 at 01:24 Permalink Edit Destroy